Index ¦ Archives ¦ RSS

LibreOffice PDF export now supports videos

Estimated read time: 2 minutes

https://farm4.staticflickr.com/3924/32549564340_4d0990cfa4_o.png

PDF supports screen annotations, which means it’s possible to play embedded and linked videos on top of a static image. Given that LibreOffice also supports videos, it made sense to add support for this in our PDF export filter. First, thanks to PMG who made this work possible. This is currently added for Writer and Impress.

Linked videos

Linked videos are the situation when the video is not part of the document itself, but it’s located somewhere else, e.g. a http:// location. This is helpful if you want to email around a PDF file, and want to avoid sending large files when it has video content.

tdf#104841 is about this situation, first I added support for linked videos in Impress, then also in Writer.

The result can be played using Adobe Acrobat Reader — for some reason okular on Linux is a bit confused about http:// URLs, wants to convert them to relative ones, and then fails as of today.

Embedded videos

https://farm3.staticflickr.com/2666/32115175413_ec6f64243a_z.jpg

tdf#105093 is the embedded video case, this is handy in case you want to create an entirely self-contained PDF, where even the video content is inside the PDF file as an embedded file.

After Impress support (and a trick around Draw vs Impress shapes) the Writer part wasn’t too complicated.

Regarding the situation around various video containers and codecs, the above code is quite agnostic. :-) On the LibreOffice side all we require is to be able to extract a key frame from the video to provide a preview image, so e.g. on Linux the support depends on what gstreamer plugins you have installed. The video content is written to the PDF file as-is, so again if it will work in the PDF reader is up to the reader’s codec support. On Linux e.g. okular uses vlc for video playback, so the range of supported formats is quite wide. The same is true on Windows, what I personally tested is LibreOffice’s VLC backend and the embedded QuickTime player in Acrobat Reader.

All of this is available on LibreOffice master towards 5.4.

© Miklos Vajna. Built using Pelican. Theme by Giulio Fidente on github.