josephwright / beamer

A LaTeX class for producing presentations and slides
Other
1.42k stars 142 forks source link

[Feature Request] Add support for embedding video with multimedia package #482

Open ArchangeGabriel opened 6 years ago

ArchangeGabriel commented 6 years ago

Hi,

I’m been playing recently with beamer and videos. The multimedia package is very nice, but one thing it lacks for me is embedding the video files inside the PDF file.

If I got things right, multimedia uses Movie annotations from PDF 1.2. PDF 1.3 added the possibility to embed files into the PDF, including movies. Having the ability to use this capacity, eventually through an optional package and/or \movie keyword, would be very nice.

There is the movie15 package that allows to do this, but it’s been abandoned for a while (it is printing a message about being deprecated and to use media9 instead, but that does not work with OSS players like evince, okular or pdfpc), does not support XeLaTeX and LuaLaTeX (there is an old patched version for the former at https://github.com/vectorgraphics/asymptote/blob/92725277aa6c2a7a798bf318dfbee947d37efa4b/patches/movie15_dvipdfmx.sty but I’m not sure how it stands vs the standard version and vs multimedia, I don’t know any possibility regarding the latter). From what I’ve read, this package was using Screen annotations from PDF 1.5, hence the name I guess, but I don’t think multimedia has to support that just to embed files, since PDF 1.3 existed before 1.5 of course. And we (I at least) don’t need any feature brought by annotations AFAICT.

Do you think adding support for this could be doable?

Thanks!

ArchangeGabriel commented 6 years ago

Oh, and I forgot to say that XeLaTeX support would be a plus, but I can live with LuaLaTeX if that’s what I get. ;)

SFr682k commented 6 years ago

Oh, and I forgot to say that XeLaTeX support would be a plus, but I can live with LuaLaTeX if that’s what I get. ;)

multimedia already supports LuaLaTeX since beamer v3.46
If you are using an earlier version of beamer, load the luatex85 package in addition to loading multimedia

ArchangeGabriel commented 6 years ago

@SFr682k Please read my issue carefully; multimedia doesn’t suits my need currently (this is about changing that). ;) I know LuaLaTeX works with multimedia, my last message was somehow implying this (I would prefer to have XeLaTeX support, but since this one doesn’t even work with multimedia in the first place, I’m aware that I am more likely to see this feature added for LuaLaTeX —and pdfLaTeX— than XeLaTeX).

josephwright commented 6 years ago

Have you looked at media9?

ArchangeGabriel commented 6 years ago

Yes (quoting myself from above):

use media9 instead, but that does not work with OSS players like evince, okular or pdfpc

Media9 use a non-standard compliant Adobe only PDF extension to embed movies and 3D objects into PDF. Only Adobe Reader supports that, and not on Linux AFAIK.

josephwright commented 6 years ago

@ArchangeGabriel In the short term it's media9 or nothing. At some stage I'll look at this area for expl3/LaTeX3, but I don't know how much is doable cross-platform and outside of Adobe Reader (a lot of stuff really only works there).

ArchangeGabriel commented 6 years ago

To be more precise, media9 uses Rich Media annotations, which is defined in an Adobe extension to the PDF norm. This rely on an embedded Flash component (hence the absence of Linux support since AFAIR there is no Flash support in Adobe Reader for Linux, and anyway the latest Linux version is completely outdated and unsecure so no one should be using that), and was introduced in Adobe Acrobat Reader 9 (hence the name media9).

Movie annotations and Screen annotations are part of the PDF standard and should be supported by any standard-compliant PDF reader. I know for a fact that Evince, Okular and pdfpc support them. I don’t own a machine under Windows or Mac to try, but I think they should be supported by Adobe Reader.

Like I said above, the current situtation is almost OK. I can use the forked movie15 with XeLaTeX or your \movie command with LuaLaTeX. So my short term is those, and I’m just looking for a long-term solution indeed. ;)

I’ll try to do a summary table of the current situation once I’ll have found the markdown doc for that.

josephwright commented 6 years ago

@ArchangeGabriel All sounds good, but I know that videos in PDFs can be 'fun'. In any case, this is on my radar, but at the moment not near the top (lots to do!).

ArchangeGabriel commented 6 years ago

I’ve found some notes I’ve read on this subject some time ago, and it seems the most common problem is the video format used. Like on Linux you can read anything gstreamer can, but on Mac OS X it’s whatever QuickTime can, and apparently that’s not a lot of things…

Also, Adobe Reader on Linux is definitively a bad case. Screen annotations and Media annotations require a plugin to be downloaded from Adobe website, but the URL (example) is apparently long dead (it was already like that in 2013…). And as I said before, Rich Media annotations are not supported because of no Flash support in the Linux version, apparently trying to load a page containing one results in something like 3D data analysis error

I’ll try to document that topic as much as possible for when you will get time for this. And yes, they are far more important things to do especially for LaTeX3. ;)

ghost commented 6 years ago

@ArchangeGabriel Maybe have a look at this answer: https://tex.stackexchange.com/a/446179/36296

It seems to be possible to install adobe reader and flash via wine on linux. This should allow you to use media9

ArchangeGabriel commented 6 years ago

@samcarter8 Wine is not on option for me.

ArchangeGabriel commented 6 years ago

So, here is my summary table.

Method Embedding Video Possible Standard pdflatex xelatex lualatex Adobe Reader poppler (Evince/Okular/pdfpc…) Other notes
Movie annotations Yes starting with PDF 1.3 (but not in any current package) PDF 1.2 multimedia no multimedia ? Yes (format/codec support provided by gstreamer) Likely the most clean way, lacks xelatex and embedding.
Screen annotations Yes PDF 1.5 movie15 movie15_dvipdfmx no ? Partial (presence of a File Attachment annotation triggers full screen playing instead of in place) A lot of other things than movies are supported (including some 3D objects) as well as File Attachment annotations (allows saving the embedded file instead of playing it, and then leaves a comment/note open)
Rich Media annotations Yes Adobe extension to PDF 1.7 media9 media9 media9 Windows, Mac (but not Linux) No Supports the most things, but requires Flash to handle everything

I will add Adobe Reader support soon (I’ll write some files to test as I’ve found a friend with both OS available). I’ll also check MuPDF.

nkoester commented 4 years ago

Like I said above, the current situtation is almost OK. I can use the forked movie15 with XeLaTeX or your \movie command with LuaLaTeX. So my short term is those, and I’m just looking for a long-term solution indeed. ;)

Can you provide a minimal working example for this as a temporary workaround please? I tried using the patched version in the demo but end up getting errors such as

demo.tex|141 error| Undefined control sequence. \pdfmark

ArchangeGabriel commented 4 years ago

@nkoester Actually I’ve moved to LuaLaTeX since then (and thus multimedia), but your issue is that you have to call the package with \usepackage[dvipdfmx]{movie15} —the option is crucial here.

Some MWE could be:

\documentclass{beamer}

\usepackage[dvipdfmx]{movie15}

\begin{document}

\begin{frame}
    \movie[height = 0.4452983725135624\linewidth, width = \linewidth, poster, mimetype='video/x-matroska', attach=false] {\includegraphics[width=\linewidth]{movie.png}}{movie.mkv}
\end{frame}

\end{document}

Where the number is the aspect ratio of my video.

laolux commented 4 years ago

Hi, I would like to point out the pdfpc-movie package which can be used to reference video files from within pdf documents. Using the pdfpc viewer one can even see the movies as if they were embedded, i.e. no external player opening.

maxnoe commented 4 years ago

Same goes for pympress.

It would be great, if this package could offer support for embedding the movie data, so one can simply share these slides without having to copy videos around.

hmeine commented 3 years ago

Would it make sense to collect the above information somewhere else?

A community wiki post on https://tex.stackexchange.com comes to my mind, for instance.

I feel like the above table and the various pointers to presentation programs is worth being maintained outside of this issue.

PS: Oh, and I would like to see SlidePilot being mentioned as well, which supports multimedia-style \movie{} on macOS (not all options, though).

PPS: This is also kind of a duplicate of #135