Latex+Beamer+PDF+embedded movies

Finally I found a way to embed videos into Latex-generated PDFs in a platform-independent way!

Download and install flashmovie.sty:

wget http://mirror.ctan.org/macros/latex/contrib/flashmovie.zip
unzip flashmovie.zip
cp flashmovie/flashmovie.sty $YOUR_TEX_DOCUMENT_DIR

Additionally, you need a flash-based video player. Free option:

cp flashmovie/flashmovie/player_flv_maxi.swf $YOUR_TEX_DOCUMENT_DIR

I preferred the Longtail Video Player which is free for personal use:

wget http://www.longtailvideo.com/jw/upload/mediaplayer.zip
unzip mediaplayer.zip
cp mediaplayer-5.7/player.swf $YOUR_TEX_DOCUMENT_DIR

This is the mencoder command I use for converting my videos:

mencoder -nosound -forceidx -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=2500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -o video.flv video.avi

And finally, a bare example showing how to create an embedded, full-screen movie in a presentation using the beamer package:

\RequirePackage{flashmovie}
\documentclass[utf8x]{beamer}
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}

\begin{document}
  \begin{frame}[plain]
    \begin{textblock}{12.8}(0,0)
      \flashmovie[auto=1,loop=1,controlbar=0,engine=jw-player,width=12.8cm,height=9.6cm]{taros_talk.flv}
    \end{textblock}
  \end{frame}
\end{document
}

The options are pretty much self-explanatory. Ah yes, the whole thing needs an Adobe Reader >=9.0.

Update: The latest version of Adobe Reader for Linux (9.4-2) gives a “3D parsing error” upon opening a page with an embedded flash video. Downgrade to 9.4-1 (Ubuntu package name is acroread_9.4-1, you can get it here) and everything’s fine

28 thoughts on “Latex+Beamer+PDF+embedded movies

  1. pretty amazing. thank you. this was something i was looking for.. if u have some updated new stuff related to it . can u please post it too or direct me to it.

    • Sure, no problem. I used it recently at an international conference, and all went quite smoothly. I can now confirm that it works with Adobe Acrobat Reader 9+ on Linux, Mac and Windows! :)

  2. How did you work around the flash crashing adobe acrobat when changing page issue?

    I spent hours searching for a solutions there doesn’t seem to be any :-/

  3. Hi I have the 3D parsing error. I couldn’t find acroread_9.4-1 on the provided link. I also don’t know how to downgrade to lower acrobat. can you please help me?

    • Well, you just click on the link. There, you download the package that corresponds to your Ubuntu version and platform. For example, if you have Ubuntu Lucid i386, you download the file acroread_9.4-1lucid1_i386.deb. After downloading, it should be enough to click on it in order to install it.

      • Thank you very much for your post and replay. It finally works and it looks exactly as I wanted. Just one thing, in the slide that has the video on, the colors are brighter than other slides, is this normal?

  4. Hi,

    Thanks for the post. There is no Adobe Reader version 9.4.1 in the link you provided. Do you know where I can find the downgraded version?

    • There is, but they are named depending on your version of Ubuntu. For example the package acroread_9.4-1lucid1_i386.deb is for Ubuntu Lucid Lynx 10.04, 32-bit Intel. I didn’t test with the latest Acrobat Readers – do you still get the “3D parsing error” when using the current version of Acrobat Reader (9.4.7)?

  5. I installed an older version of Adobe, but when I try to loop the file it just gives me a loading icon and does not automatically replay the file :-(

  6. I am trying this method to embed some videos in my beamer presentation. Unfortunately I have the latest updated acroread installed and which gives the “3d parsing error”. ON top of that, it has messed up my dpkg in some way so that If I try to remove or purge it from my system, it reaches a “LSB module not available” error page and freezes. After this I always need to use kill -9 to terminate dpkg and then do a configure -a to reset it every time. I am not able to remove this version of acroread or force install the downgraded package on top of it. Can you help?

  7. I have a linux box running fedora 17.
    I am able to load the movie running AR 9.4.1, but I have the problem that it crashes when changing the page that has the movie loaded.
    I have also tried the -nosound option when creating the movie, and it also crashes.

    Could you give the texlive version you have? mplayer version? pdflatex version?

    Thanks in advance!

  8. Hi all!
    Does anyone solved the problem with crashing Acroread while changing the page? I’m slowly getting crazy with this stupid bug.

  9. Me too! I have spent the whole night trying to get this to work. Now I’m so close! If only it didn’t crash when I changed the page.

    Regardless, thanks for the post.

  10. Very useful info! I am struggling against the changing page issue. I have tried using both the free flv-player and the jw-player, with the same result: after I change page AR crashes. Again, same result with a directly embedded swf movie with no engine specified. Anybody managed to solve this? thanks!

    • Hi Tom, I was just curious if you had ever tuohght of using Centos? Supposedly just like RH EL just with all the hats taken out. I had a 10gR2 release up and running on my laptop in VM and it was working fine as far as I could tell. Shameless Centos plug I liked the character mode installer as well. Much easier to do remote installs without VNC, etc.

  11. Are you all using Ubuntu 12.10? I also have this crashing-when-changing-page problem and I’m running 12.10. If anyone find a solution, please tell!

  12. For MEncoder SVN-r36573-4.8.2 the new command options are `mencoder -nosound -forceidx -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=2500:mbd=2:mv0:trell:v4mv:o=mpv_flags=+cbp_rd:last_pred=3 -o movie_out.flv movie_in.mp4`

  13. You can also directly use the

    \href{run:myvideo.avi}{\fcolorbox{blue}{white}{\includegraphics[width= 7cm]{mypreview.jpg}}}

    command, which does not need any external package. The video will be played in your usual video player.

Leave a Reply

Your email address will not be published. Required fields are marked *