The Complete Guide to Embedded Videos in Beamer under Linux


Edit: A better solution is to use pdfpc. See my new guide.


It is now possible to embed videos in Beamer presentations under Linux.  It’s stable and works well.

The strategy is to use acroread and a flash player to play .flv files. Credit to this post for a lot of this work. Here’s how to do it:

The short version:
1. Get acroread version 9.4.1 [local mirror]
2. Download the example.
3. Convert your video to flv (mess with the resolution to get smooth playback).

ffmpeg -i movie.avi -sameq -s 960x540 movie.flv

 

Now the explanation:


I. Get the right version of acroread.


1. Uninstall acroread using apt-get (which isn’t likely to be the right version)

sudo apt-get remove acroread

2. Download version 9.4.1 of acroread from Adobe (note that the i486 version will still work on 64-bit systems) [FTP page] [local mirror]
3. Mark the package executable:

cd your-download-directory
chmod +xx AdbeRdr9.4.1-1_i486linux_enu.bin

4. Install acroread:

./AdbeRdr9.4.1-1_i486linux_enu.bin

I installed to /opt/acroread, so I run it like so:

/opt/acroread/Adobe/Reader9/bin/acroread

II. Get Beamer files and flash player



Credit goes to Jens Nöckel’s post for figuring this out.

1. Download the beamer/flash player package [local mirror]
2. Extract them all to the same directory as your .tex file (not in a /flashmovie/ subdirectory)


III. Convert your movies to .flv


1. Get ffmpeg

sudo apt-get install ffmpeg

2. Convert your movie to a .flv:
Note: You might have to resize your movie if the resolution is high to get smooth playback. You can do this with the -s flag as below.

ffmpeg -i movie.avi -sameq -s 960x540 movie.flv

IV: Add the movie to your beamer slideshow


1. Add the package to the very first line of your .tex

\RequirePackage{flashmovie}
% it is necessary to use "\RequirePackage{flashmovie}" because beamer
% also uses "\pdfminorversion". see flashmovie.sty for an explanation.

2. Embed the movie

\frame[plain]
{
    ...stuff...
    \flashmovie[engine=flv-player,auto=1,controlbar=0]{movie.flv}
    ...stuff...
}

V: Changing the background color / removing controls

I wanted to use black backgrounds and remove the control bar so I changed line 580 of flashmovie.sty to:

/FlashVars (flv=#2&margin=0&showvolume=1&showstop=1&showtime=1
    &showplayer=never&videobgcolor=0x000000\flashmovieautovari
    \flashmovieimagevari\flashmovieloopvari)

(note this was line wrapped and should be one line)

If you want a different color change the value in videobgcolor to something else (it’s like HTML colors).


VI: Full frame movies


(You’ll find all this and more in my example.)

The default beamer templates don’t support full-frame movies very well. Here’s my functions; put them right before \begin{document} for a full frame movie.

%%%%%%%%%%%%%%%% Useful commands %%%%%%%%%%%%%%%%

\newcommand\CopyrightText[1]{%
  \begin{textblock*}{\paperwidth}(0\paperwidth,.97\paperheight)%
    \hfill\textcolor{white}{\tiny#1}\hspace{3pt}
  \end{textblock*}
}

\newcommand{\citeFoot}[1]
{
    \rule{\linewidth}{0.5pt}
    {\scriptsize #1}
}

\newcommand{\fullFrameImage}[2]
{
    {
        \usebackgroundtemplate{\includegraphics[height=\paperheight]{#1}}
        \frame[plain]
        {
            \CopyrightText{ #2}
        }
    }
}

\newcommand{\fullFrameMovie}[2]
{
    {
        \setbeamertemplate{background canvas}[vertical shading][bottom=black,top=black]
        %\setbeamercolor{background canvas}{bg=black}

        \frame[plain]
        {
            \begin{textblock*}{\paperwidth}(0px,0px)%
            \flashmovie[width=\paperwidth,height=0.96\paperheight,engine=flv-player,auto=1,controlbar=0]{#1}
            \end{textblock*}
            \CopyrightText{#2}
        }

    }
}

\newcommand{\blackframe}
{
    {
        \setbeamertemplate{background canvas}[vertical shading][bottom=black,top=black]
        \frame[plane]{}
        \addtocounter{framenumber}{-1}
    }
}

%%%%%%%%%%%%%%%% End useful commands %%%%%%%%%%%%%%%%

To use it:

\fullFrameMovie{movie.flv}{\textcircled{c} 1990 Someone Here}