[Tex/LaTex] Animations with movie15 and swf files

animationsmovie15swf

I am trying to use movie15 to embed vector animations in my presentation. The trouble is that embedded SWF files refuse to display on Acrobat Reader X sometimes with a "This Media requires an additional player" message. Eg. this example file doesn't work.
Animated GIFs won't display either, with no error message.

Maybe this is an Acrobat issue but I tried the flashmovie package with the same SWF files and that does work (but only with the embedded player option so no controls are visible). But flashmovie is supposedly unstable with beamer so I was wondering if someone had run into the same problem with movie15.

I am using Windows 7, Acrobat 10.1.2 and MiKTeX.

Best Answer

The replacement package is available on CTAN. It is called media9 and documented on CTAN.

Use the MiKTeX or TeXLive package managers for installation.

A simple example embedding an SWF would be

\documentclass{article}
\usepackage{media9}
%\usepackage[dvipdfmx]{media9} % only for latex->dvipdfmx

\begin{document}
\includemedia[
  activate=pageopen,
  width=200pt,height=150pt,
]{}{myexample.swf}
\end{document}

A minimal example for embedding a video file, using the video player component VPlayer.swf shipping with media9 and using the pdflatex, lualatex, latex-->dvips-->ps2pdf or latex->dvipdfmx/xelatex work-flows would be

\documentclass{article}
\usepackage{media9}
%\usepackage[dvipdfmx]{media9} % only for latex->dvipdfmx

\begin{document}

\includemedia[
  activate=pageopen,
  width=200pt,height=150pt,
  addresource=Sample.mp4,
  flashvars={%
     source=Sample.mp4% same path as in addresource!
%   &autoPlay=true%    % optional configuration
%   &loop=true%        % variables
  }  
]{}{VPlayer.swf}

\end{document}

Video files must be in the MP4 format. Videos in other formats must be converted to MP4, or recreated from the raw material. The H.264 codec gives high quality video at stunningly small file size. With ffmpeg, video files can be created easily.

From an existing video file, such as Sample.avi, re-encoded with 30 frames (entered on a single command line):

ffmpeg -i Sample.avi -vf scale="trunc(iw/2)*2:trunc(ih/2)*2"
    -c:v libx264 -profile:v high -pix_fmt yuv420p
    -g 30 -r 30 video.mp4   

From a numbered sequence of bitmaps, such as frame-0.png, frame-1.png, ... :

ffmpeg -i frame-%d.png -vf scale="trunc(iw/2)*2:trunc(ih/2)*2"
    -c:v libx264 -profile:v high -pix_fmt yuv420p
    -g 30 -r 30 Sample.mp4