Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm aware that it's possible to embed some kinds of videos and animations in LaTeX files (using the beamer or prosper classes) but I couldn't locate good documentation on this. My web searches returned a list of scattered forum questions and answers.

Could anybody give a link to some help or documentation page that systematically deals with the various ways of embedding videos and animations, the file types that work, etc.?

share|improve this question

6 Answers 6

I recommend using

\usepackage{media9}%
\newcommand{\includemovie}[3]{%
\includemedia[%
width=#1,height=#2,%
activate=pagevisible,%
deactivate=pageclose,%
addresource=#3,%
flashvars={%
src=#3 % same path as in addresource!
&autoPlay=true % default: false; if =true, automatically starts playback after activation (see option ‘activation)’
&loop=true % if loop=true, media is played in a loop
&controlBarAutoHideTimeout=0 %  time span before auto-hide
}%
]{}{StrobeMediaPlayback.swf}%

in the preamble and

\frame[label=blah]{
\begin{center}%
    \includemovie{.85\textheight}{.85\textheight}{movie.mp4}%
\end{center}%
\note{%
    \begin{itemize}
        \item blah
        \item blah
    \end{itemize}
    }%
}%

to produce a slide with a movie.

Background. I was used to the simplicity of movie15 but this was superseded by movie 9. This command provides with a "backward compatible" syntax with all the novelty of movie9.

share|improve this answer

I personally use hyperref package to start animations and movies during the presentation. This is the snippet of code from one of my Powerdot slides

\begin{center}
\href{run:/usr/local/bin/mplayer -fs forced_pendulum.mp4}{
\includegraphics[scale=0.25]
{forced_pendulum.eps}}
\end{center}

One caveat is that the code lunches MPlayer which plays video but the video is not "embedded" into the slide. I am guessing that I can fix that playing little bit with PSTricks code. In particularly animations done in the pure PostScript should not have any troubles running embedded. The upshot of my approach is that it should work on any class of LaTeX presentations and that doesn't require any particular PDF viewer (mupdf in my case) or any particular operating system for that matter.

share|improve this answer
7  
That also requires the user to have mplayer installed to that specific location. Wouldn't calling the default player for that filetype be a better option? –  Canageek Jul 24 '12 at 2:50
4  
@Canageek absolutely correct observation. I used absolute path on my machine to "improve security". Executing scripts from PDF documents is not exactly the safest thing to do. I agree with you the above is the most simplistic solution and can be easily improved a lot. –  Predrag Punosevac Jul 24 '12 at 21:25

There's mention of the movie15 package in one of the other answers. This package has been replaced by the media9 package and is marked obsolete.

There's a nice example of how to use the media9 package here:

Animations with movie15 and swf files

Two other possibilities are beamer, and yt4pdf (for youtube videos), neither of which I've tried yet.

I've had mixed luck with the default player, VPlayer.swf when using the media9 package (it worked fine with the .avi's I used when trying movie15, but not so well on all the ffmpeg generated .mp4's required for media9). StrobeMediaPlayback.swf (recommended in the question above) appears to be more reliable. It also has some nice features like detachable player windows and fullscreen options.

share|improve this answer
    
Which were the symptoms of the failed attempts? yt4pdf wants Acrobat for producing the pdf. –  AlexG Apr 2 '12 at 7:22
    
the pdflatex invokation goes without error, but of the four .mp4's that I tried, two show as only images, and the other two display correctly as video. I'm able to play the .mp4's with windows media player without trouble and generated all of them in the same way (using mathematica to generate .avi's and then ffmpeg to convert the .avi's to .mp4's). –  Peeter Joot Apr 3 '12 at 3:30

The flashmovie package allows you to embed flash movies in pdfLaTeX documents. You need Acrobat Reader 9 to view the documents.

share|improve this answer

One possibility is to use the animate package.

There is a nice pile of examples showing animate usage over on TeXample.

share|improve this answer

I'm personally only familiar with doing this in Beamer, which uses the multimedia package, distributed as part of Beamer itself. (Although it can be used in normal documents as well, independently from the rest of Beamer) The canonical reference on how to use the multimedia package is the Beamer user's guide, section 14.1, but basically it boils down to using the command

\movie[options]{placeholder box}{movie filename}

The placeholder box is some text or other content (could be an image, for example) that determines the size at which the multimedia file is shown.

The multimedia file can be shown either with an external viewer application, which launches when you click on the appropriate part of the PDF file, or directly in the PDF viewer itself. In both cases, though, this functionality is only supported by certain PDF viewers, mostly Adobe Reader. The file types it is able to display depend on the capabilities of the PDF viewer, or if using an external viewer, on which viewer program is being used.

A quick search on CTAN turns up one possible alternative, movie15. According to the documentation, its main command is

\includemovie[options]{width}{height}{media file}

and it seems to offer some of the same main features as Beamer's multimedia. However, I've never used this one myself so I can't say anything about it that isn't mentioned in the package documentation.

share|improve this answer
1  
I've had good luck using the movie15 package, although it does seem to require Acrobat Reader to play the movies. Maybe some other viewers will work, but you definitely can't count on it in general. A nice feature is the ability to define a 'poster' image that takes the place of the movie when the movie is inactive. This way you can still have something meaningful on the slide if it turns out your viewer can't play the movie. –  Michael Underwood Aug 12 '10 at 1:10
    
@Michael: The problem is that PDFs with embedded multimedia use Adobe's Rich Media extensions, which are not widely supported, to say the least. In fact, I don't know of any independent codecs for it, although Adobe do have a plugin that can be embedded in other software, and is embedded in MS Power-Point. –  Charles Stewart Aug 12 '10 at 13:28
3  
movie15 is deprecated and has been replaced by media9 (see the answer by @Peeter-Joot –  meduz Jan 8 '13 at 20:21
1  
Perhaps I'm the only one, but it took me a few error messages to realize multimedia is not automatically loaded by beamer, its distribution means notwithstanding. –  Chris White Mar 12 at 18:37

protected by Martin Scharrer Jan 3 '13 at 13:32

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.