How to add a video in Latex/Beamer
  • The following method works using the latest versions of Okular (KDE's default pdf viewer):
\RequirePackage{flashmovie}
\usepackage{multimedia}
...
\movie[loop,poster,showcontrols=true]{\includegraphics[width=<width>, height=<scaledheight>]{<posterimage.png>}}{movie.avi}}
  • Another option is to use an animation of video frames. This method works with Adobe reader but not with okular or evince.

First you need to extract the frames of the video using ffmpeg (mencoder can also be used for this job):

ffmpeg -i inputfile.avi -r 15 image-%3d.png

Usage:
i: the input video file
r: This is used to set the video frame rate. It is actually the number of frames (images) to be extracted per second. The default value is 25.
image-%3d.png: This option defines the image format. Using %3d the naming of the image files will have the following format "image-001.png", "image-002.png" etc.

\usepackage{animate}
...
\animategraphics[autoplay,loop,height=100pt]{15}{image-}{001}{340}

The previous latex code will animate all the images with filename image-001.png to image-340.png in loop mode.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License