[texhax] Animation inclusion in Beamer

Steve Schwartz s.schwartz at imperial.ac.uk
Thu Mar 22 17:40:56 CET 2007


The answer also depends on what operating system you use. In particular,
acroread on a linux/unix system does NOT support whatever is needed to
make movie15 work. But you can show animations using pdf/hyperref run
links in your presentation. These launch a shell script that will in
turn launch an external player (such as gmplayer). Here's how I do it:

In your latex source put, for example:

\href{run:movie_script.sh}{Click Here}

You can put anything you like in place of "Click Here", such as a still
frame from your animation.

Then you need a shell script (movie_script.sh in the above example, but
you can call it whatever you like) which has the command line to launch
the player. I use mplayer, which gives you pretty good control over
positioning, looping, and minimal window adornments:

mplayer -geometry 50%:50% -nofs  /home/sjs/movies/mymovie.mpg

Then when you use acroread (or any other pdfviewer that supports
hyperlinks), clicking on the link in your presentation will play your
movie; use mplayer's keystroke commands to quit it or whatever. Hint:
hide away your menubar or that will come to the front during the movie.

You may find that acroread complains that it doesn't know what to do
with your .sh file. This happens if you don't have sh defined in
your .mailcap and .mime.types. You can fix this by:

In ~/.mailcap add:
application/x-sh; /bin/sh %s

In ~/.mime.types add:
application/x-sh sh

WARNING: These are a potential security risk, because it also teaches
your browser how to run shell scripts it may find in a (malicious)
web-page, and it will run them without prompting. There are two ways
around this:

I think it should be possible to define your own mime.type, such as
moviesh, and then call your script movie_script.moviesh, with the
appropriate changes to the .mailcap and .mime.types entries, replacing
x-sh by x-moviesh. This is still theoretically insecure, but requires a
webpage that has a script file with a .moviesh ending. You could make
this more secure by making the suffix cryptic, e.g., Ab23_ZbG

The other way is to teach your system how to play movies, e.g.:

In ~/.mailcap add:
video/*; mplayer [options] %s

You will obviously need to teach .mime.types about suffices for video
Then you can run the movie directly:

\href{run:mymovie.mpg}{Click Here}

This is secure, but you lose the control over the options for mplayer
for your animations.

One day Adobe will provide the support in acroread to handle players and
the movie15 solution will work. In the meantime the above works for me
(with thanks to several people along the way that gave me the pointers
to how to do this).


On Thu, 2007-03-22 at 15:25 +0100, Victor Ivrii wrote:
> On 3/22/07, Anantha rangan <ananta.rangan at gmail.com> wrote:
> > Dear tug support manager, I am a new user of Latex and am using Beamer for
> > presentation. I am unware of the procedure of using animated movie files
> > which are in Mpeg format.   Since I have aready prepared the presentation in
> > Beamer, I would wish to have the details of the package and the way to use
> > it ( commands) .Kindly inform me the same.  Thanking you
> Download from CTAN, install and use package movie15. Works like a charm.
> Be aware that you need to use acroread (Adobe Reader) to present
> beamer and acroread itseld does not play movies but calls the player,
> so you need to have the player installed and acroread (or OS) to know
> whom to call (probably everything is configured already). In this and
> pdftex mailing list you can find other discussions about this.
> This is a general mailing list and there is no support manager (or
> everyone including you is)

Professor Steven J Schwartz      Phone: +44-(0)20-7594-7660
Space and Atmospheric Physics    Fax:   +44-(0)20-7594-7772
The Blackett Laboratory          E-mail: s.schwartz at imperial.ac.uk
Imperial College London          Office: Huxley 6M70 
London SW7 2BW, U.K.             Web: http://www.sp.ph.ic.ac.uk/~sjs

More information about the texhax mailing list