Bug 376574 - Linked video in pdf doesn't work
Summary: Linked video in pdf doesn't work
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Unclassified
Component: PDF backend (show other bugs)
Version: 0.26.1
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-17 08:55 UTC by Miklos Vajna
Modified: 2017-02-20 09:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Reproducer document. (75.08 KB, application/pdf)
2017-02-17 08:55 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Vajna 2017-02-17 08:55:23 UTC
Created attachment 104071 [details]
Reproducer document.

Hi,

LibreOffice recently learned exporting embedded and linked videos to PDF. The export result is primarily validated by Adobe Acrobat, but I also checked okular. The embedded video plays nicely -- I think on openSUSE Leap 42.2 it's configured to use vlc for the actual video playing.

Linked video doesn't work, I'm attaching the details. First the reproducer document.

The document is created in LibreOffice by inserting a linked video from the filesystem, then tweaking the ODF file (zipped XML) manually so it links a HTTP URL instead.
Comment 1 Miklos Vajna 2017-02-17 08:57:56 UTC
Console output:

[00007f613c00dce8] filesystem access error: cannot open file //home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4 (No such file or directory)
[00007f613c00dce8] core access error: File reading failed
[00007f613c00dce8] core access error: VLC could not open the file "//home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4" (No such file or directory).
[0000000001af96b8] core input error: open of `file:////home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4' failed
[0000000001af96b8] core input error: Your input can't be opened
[0000000001af96b8] core input error: VLC is unable to open the MRL 'file:////home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4'. Check the log for details.

Looks like it tries to convert http://vmiklos.hu/file/small.mp4 to a relative file:/// URL.
Comment 2 Oliver Sander 2017-02-17 09:10:57 UTC
Confirmed, both with 0.26.1 from Debian Testing and with the current git master.
Comment 3 Oliver Sander 2017-02-17 21:39:16 UTC
The problem is in the file videowidget.cpp, in the method VideoWidget::Private::load().

There, starting in line 110 is says

    QString url = movie->url();

Here, url is the movie location, namely http:/vmiklos.hu/file/small.mp4

The code continues:

    QUrl newurl;
    if ( QDir::isRelativePath( url ) )
    {
        newurl = document->currentDocument().adjusted(QUrl::RemoveFilename);
        newurl.setPath( newurl.path() + url );
    }

and sure enough, QDir::isRelativePath takes the content of 'url' to be a relative path, because it does not start with '/'.   Hence the 'if' branch is taken, and the document path is prepended to the movie part. Seems like the code was not written with internet movies in mind.

Strangely enough, the code continues:

    if ( newurl.isLocalFile() )
        player->load( newurl );
    else
        player->load( newurl );

Surely that's not right?  Martin, you introduced this in d8fdb1494 , can you please have a look?
Comment 4 Albert Astals Cid 2017-02-20 00:07:15 UTC
Git commit ee7e3737f4d2031e9bac9f5a25ac0b31c2f5e496 by Albert Astals Cid.
Committed on 20/02/2017 at 00:06.
Pushed by aacid into branch 'Applications/16.12'.

Account for non local non relative video file urls

M  +22   -32   ui/videowidget.cpp

https://commits.kde.org/okular/ee7e3737f4d2031e9bac9f5a25ac0b31c2f5e496
Comment 5 Miklos Vajna 2017-02-20 09:16:38 UTC
Thanks a lot! :-)