The Portable Document Format (PDF) is much more than just a substitute for paper. While printable documents are thought of as static, PDF can be dynamic and interactive, see for example these interactivity demos. In fact, since Adobe has acquired Macromedia, some convergence of PDF and Flash might be expected in the future. But if you go through my example on this page, it will be clear that PDF all by itself at this point in time has (almost) all the features a multimedia author could ask for.
The context of this page is the problem of how to prepare scientific/technical documents. If you have looked at my suggestions for doing scientific presentations using Apple's Keynote, you should be convinced by now that LaTeX is an essential ingredient for any computer-based talk with mathematical content.
In particular, I included some links to LaTeX-based PDF presentation tools that can do almost anything that Keynote can do, based on the power of Adobe Reader.
Traditional movies are essentially sequences of resolution-dependent (rasterized) images, with additional information on how fast to play the frames. But PDF is a format that can display both vector and raster graphics, where the big advantage of vector graphics is its resolution-independence. Therefore, movie formats with vector-graphics frames would be a natural choice for embedding into PDF. The most important such format is Flash SWF format. Based on the type of movie, we can then distinguish three distinct solutions:
Mpeg etc.)
SWF)
For all of these cases, LaTeX provides solutions. The first two are addressed by the movie15 package, and the last one can be achievd by the animate package. We'll not discuss the latter on this page.
Let's explain how to put multimedia content into PDF presentations. If you look at the manual for the LaTeX beamer class, there is in fact a rather detailed description of the necessary commands for movie or sound inclusion. Use that approach if you are developing a really fancy presentation.
On this page, I'll describe the approach that is best suited for a small, "bare-bones" presentation without much stylistic overhead. To do this, you should use the LaTeX style called movie15.sty created by Alexander Grahn. On Mac platforms, the TeX-Live 2007 distribution contains this package already, whereas the tetex distribution doesn't. To check whether your LaTeX installation contains this style, just typeset the movie.tex file below and see if it gives you an error message. In that case, you'll need to donwload the style file:
movie15.sty to a place where latex can find it (i.e., in a local texmf directory), and invoke texhash (in superuser mode) to make latex aware of the new file (if you want to test this first, just put the style file into the same directory as your tex document and invoke pdflatex). The movie15 download also includes documentation and an example. In the following, I'll walk you through my own example.
You may also need to install additional packages required by movie15.sty, in particular ifdraft. Right-click on this link and download the file ifdraft.dtx. Then do tex ifdraft.dtx followed by sudo mv ifdraft.sty ... to some directory searched by TeX. Don't forget to type sudo texhash to make TeX aware of the new files.
PDF movies can be displayed with Adobe Reader. In case you encounter problems on a Mac running Tiger (OS X 10.4+), make sure you have the most recent version (7.05 or higher - preferrably version 8) of Adobe Reader. The Preview Application is not an alternative here because it does not handle multimedia plugins. There are no problems with older version of Adobe Reader on Mac OS Panther, as far as I can tell.
Also note that you cannot use Linux acroread to display multimedia embedded with the help of this package. In KDE 4, you can use Okular to view PDFs with embedded movies.
For several years, the way I've been putting movies into PDF presentations has been based on direct application of \pdfannot or \pdfmark - commands understood by pdflatex which allow you to write PDF code. The style movie15.sty by Alexander Grahn uses these commands to create a very flexible and user-friendly way to do this without having to leave the LaTeX level. This package is able to use the features of the newest Adobe Reader, including 3D virtual reality interactivity. Here, I'll address only traditional movie playback to keep things simple.
The method is best described by example.
Assume you have the following movie in MPEG or AVI format (I have an mp4 movie on this web page, but other formats also work):
To create MPEG or other formats, here are some tools (for Mac OS X):
File > Export Slide Show to Movie
convert which on my platform allows conversion to mpgeg (by automatically calling one of the programs mentioned before)..
For additional information, see the pages on making movies.
Flash movies work, too, and this opens additional possibilities for interactivity in your PDF document.
pdflatex.
movie.tex) in the same directory as the movie, containing the following:
\documentclass[12pt,landscape]{article}
\usepackage{geometry}
\geometry{verbose,letterpaper}
\usepackage{movie15}
\usepackage{hyperref}
\begin{document}
Whispering-gallery mode in a quarter circle:
\begin{figure}[ht]
\includemovie[
poster,
text={\small(Loading Circle-m-increase3.mp4)}
]{6cm}{6cm}{Circle-m-increase3.mp4}
\end{figure}
\end{document}
The LaTeX file is downloadable by clicking here.
The \includemovie command is the crucial object here. Its last three arguments are the dimensions of the movie and the file name. The dimensions can be chosen arbitrarily and will cause the movie to be rescaled accordingly.
The commands related to geometry and landscape are not essential; they just turn the output page sideways for on-screen viewing. I added the package hyperref even though it gets loaded automatically when pdflatex is invoked. The reason I put this in is that the file can then be processed either using pdflatex movie (the preferred way) or using latex movie followed by dvipdf movie to create the PDF output.
movie.pdf with Adobe Reader or Acrobat. The output file can also be downloaded by clicking here. The movie is automatically loaded and represented by its first frame ("poster frame"). Playback starts after you click on the picture and stops on the last frame. I didn't put in any visible movie controls because they appear to be buggy under Windows (thanks to Alexander Grahn for mentioning this). With Mac OS X, controls work fine, so you could add the option controls to \includemovie and obtain the same appearance as on this web page. Even without control buttons, one can always restart the movie by double-clicking on it (this applies to Mac; for Windows, you may just need a single click).
pdflatex, so upgrade your tex distribution if necessary.
Observe one fascinating detail:
The movie itself is contained in the PDF file, instead of having to be shipped as a separate file. In other words, we have created something that deserves the name Portable Document Format. The caveat of course is that the movie (or any other multimedia content for that matter) will only play properly if the PDF viewer manages to find an external program that can read the embedded file format. That is why it is not advisable to use exotic or platform-specific video formats (e.g., .WMV) if you want to send your PDF file to other people.
Everything that was said above also applies if the movie you want to include is in Flash SWF format. As mentioned above, the big advantage is that Flash delivers vector animation inside your PDF document. An example file, movie-swf.pdf, shows the result of modifying the \includemovie line in our tex file as follows:
\documentclass[12pt,landscape]{article}
\usepackage{geometry}
\geometry{verbose,letterpaper}
\usepackage{movie15}
\usepackage{hyperref}
\begin{document}
Created by James N{\"o}ckel, January 6, 2008:
\begin{figure}[h!]
\includemovie[
poster=flashposter.jpg,
text={\Large\bf Click to start\hspace*{400pt}}
]{550pt}{400pt}{blendone.swf}
\end{figure}
\end{document}
This works on OS Xprovided you have installed the latest update of Adobe Reader (with version 9.1 installed, Adobe Updater provides a fixed version 9.1.2).
Since the poster frame (image shown before the movie is started) can't be found automatically for this Flash animation, I've inserted an image flashposter.jpg by hand.
As above, you need Adobe Reader to play this movie. Version 8 is required, as is an up-to-date version of Flash Player.
The animation blendone.swf was created by James Nöckel, Jan. 06, 2008. Please credit him if you distribute this file in any way!
Speaking of credit for authors of digital media: Adobe has recently announced enhanced digital-rights management capabilities for Flash. Other formats such as Quicktime already offer this, so there isn't really any surprise that Flash wants to offer it, too. The worry may be that Flash movies and games will therefore become less freely available. Looking at some of the Flash games that are out there, this may actually be a good thing... (take this page for example).
But the truth is that giving the author some control over what people do with his or her work should generally be a matter of common sense. It is not in itself a bad development, because authors who want to distribute their work for free can still do so with the same technology. And you wouldn't want to distribute free copies of a file if the author doesn't want you to, right?