[Tex/LaTex] How to include a movie in a PDF? Step by step instructions

acrobatmedia9movie15multimediapdftex

There are a few question/answers regarding the embedding movies in PDF with pdflatex and special packages. However I find the information dispersed all around and confusing. And so far, in the best cases I get a "3D rendering error in Acrobat Reader" and I don't know what step is failing.

Maybe this particular case serves as guide for a step by step explanation:

  • pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian), Acrobat Reader 9.5.1, Linux (Ubuntu 12.04). Need to upgrade something?
  1. Let's start with a movie file: movie.avi with FFmpeg MPEG-4 encoding. Does it need to be encoded in some other way? what is the best tool to reencode? what encodings are going to work? Is a conversion to flv format really necessary?

  2. pdflatex: what packages need to be included, media9, movie15 (obsolete?), flashmovie?

  3. what is the latex command to include the movie? Can one have the option to keep the file inside the PDF or external?

  4. How does one get the playback controls rendered with the movie inside the page? Does one really have to use a third party flash-based movie player? If so which player works with Acrobat 9.5.1?

  5. Can I expect the movie to be player inside the PDF page in the monitor? Can one expect to have a preview of the movie (first frame) in the static rendering of the page.

  6. Can one expect the resulting PDF and embedded movie to work when switching to Windows/Linux/OSX?

  7. Does one need to change (hidden?) security preferences in Acrobat to see the movie?

A solution compatible with beamer is also desirable.

Best Answer

A more specific and updated answer can be found in my answer to Did anyone succeed in playing embedded movies inside Acrobat in Linux?

  • As for production of PDF, no update needed. Sadly, there is no media playback (except for 3D) in AR for linux since v. 9.4.1. It was disabled for obscure reasons. Some opensource PDF viewers on Linux support playback of media that were embedded using movie15.
  1. Re-encode for use with media9: ffmpeg -i movie.avi -sameq -vcodec libx264 -x264opts keyint=25 movie.mp4 or ffmpeg -i movie.avi -sameq movie.flv. For movie15 there is probably no re-encoding required, but playback mileage may vary on different computers depending on installed media players and codecs.

  2. media9 or movie15.

  3. media9 and movie15 physically embed media files into the PDF. movie15 allows for external files (option inline=false). Both allow for media loaded from URLs during runtime.

  4. For AR-9/X compatible media (media9), playback controls are provided by the media-player Flash-component being used (e. g. StrobeMediaPlayback.swf or Youtube-URL). AR-9/X compatible media always need a Flash-based media player.

  5. Static images can be inserted with \includegraphics{...} as the next-to-last argument of \includemedia (media9) or with text option of \includemovie (movie15).

  6. media9 embeds Flash (SWF), sound (MP3), video (MP4/h.264, FLV) and 3D (PRC, U3D) with AR-9/X for Win and Mac compatibility. Linux AR-9 only supports embedded 3D. All media files are rendered by the AR built-in FlashPlayer or 3D renderer. Thus, above-mentioned media will reliably play on any Win and MacOSX box with AR-9 or X installed.

    movie15 embeds sound, video, Flash and 3D with AR-6/7/8 compatibility. Again, Linux version of AR only supports 3D. Okular, Evince support video playback on Linux. Note that all PDF viewers including AR on Win and Mac depend on third-party media players that must be installed on the host computer. Thus, media file formats and codecs that can be played back highly depend on the available players. The risk of failure is high, in particular in a conference/lecture situation on an unknown computer.

  7. media9: no; movie15: yes