Embed movies in PDF documents with LyX, latex-beamer and movie15
These are some notes on how I embedded movies in PDF presentations made with LyX and the latex-beamer class. This is basically an adaptation of the instructions from http://www.uoregon.edu/~noeckel/PDFmovie.html. The only difference is that I used LyX and used WMV videos instead of MP4 as that seemed to work, whereas mp4 or other formats would require additional codecs to be installed.
I created the presentation using LyX, latex-beamer and the movie15 LateX packages. If you have all these installed, you can skip this part and proceed to the steps below, else read on.
LyX is a document processor and an interface to LaTeX. You can download the installer from the homepage. The current version for Windows can be downloaded here. This is a bundle that includes the MikTeX, LateX typesetting system. Perform a standard installation. It will take some time for everything to get installed. The bundle also installs latex-beamer and movie15. If this is not the case, you will need to install them separately.
Beamer is a LateX class for creating presentations. For more information, see this Wikipedia entry. The homepage is no longer maintained and a new version is on the works. It can be installed using the MikTeX package manager found under:
Start -> Programs -> MikTeX -> Maintainance (Admin) -> Package Manager(Admin)
movie15 is a LateX class for embedding movies, sounds and 3d objects within PDF documents. Install this using the same procedure as Beamer.
This is needed for LyX to recognize the newly installed packages. open LyX and do a:
I downloaded the Big Buck Bunny trailer (Small(iPhone) version) from the trailer page and converted it to wmv format. I used ffmpeg for this purpose. You can use any wmv file you may have.
In LyX create a new document and from the:
Document -> Settings
as the Document class
Create a new frame.
Choose BeginFrame from the combo box in the toolbar
End the frame by selecting the EndFrame layout from the combox box.
If the video playback works fine, the pdf can be exported using:
File -> Export -> PDF (pdflatex)
the pdf will be saved in the same directory.
The procedure is same except that the generated pdf cannot be tested using the Linux version of Acrobat reader. It does not support video playback only provides the option of using RealPlayer as the multimedia player even though VLC, MPlayer or Xine is present. Okular seems to identify the embedded movie but does not play it.
As for the programs concerned, I got them installed from the following sources on my openSUSE 11.2 laptop.
- LyX - main repository(oss)
- latex-beamer - openSUSE Education
- movie15 - I could not find this in the repositories. So, this had to be installed manually. I downloaded the movie15.zip from the homepage and uncompressed the zip archive to ~/texmf/tex/latex followed by doing a texhash and reconfiguring LyX.
To convert the m4v video, I used the following ffmpeg command:
ffmpeg -y -i "trailer_iphone.m4v" -acodec wmav2 -ab 128kb \ -vcodec wmv2 -b 1200kb -mbd 2 -cmp 2 -subcmp 2 "bbb.wmv"
The LyX file, the generated pdf and the movie file can be downloaded as an archive from here.