How do I embed a mpg video in Beamer presentation using media9?

I just read the documentation for media9 but was not able to identify what I am doing wrong. The videos in the documentation all play fine in my installation of Adobe Acrobat Pro. When I compile the example below, the slide has a box for the video that says "(click to play)" but when I click, all I see is white.

\documentclass{beamer}

\usepackage{media9}

\begin{document}

\begin{frame}{}
\includemedia[width=0.6\textwidth,height=0.45\textwidth]{(click to play)}{4x167_h5_k010.mpg}
\end{frame}

\end{document}


Here is a link to the mpg file I am including. I am actually not sure the aspect ratio of the video. In addition to even showing up and playing, I am also interested to know the following

1. Do I have to specify both the width and height? I would rather specify the width and that it maintain the same aspect ratio.
2. How do I get it to loop (I saw info in the documentation about this, just wanted to get it the play first)?

(I also tried the movie15 package and that gives a box that is all black)

• Video file must be in MP4/H.264 format. MPEG is not supported. Then copy-paste the example in tex.stackexchange.com/a/102600 and replace the video file with yours. Yes, you should know the video's aspect ratio beforehand; TeX cannot determine it as it doesn't know anything about video formats. Alternatively, you can \includegraphics{...} a still image with appropriate aspect ratio instead of (click to play). Then zero or one of width= or height= is required if further scaling is needed. – AlexG Nov 12 '15 at 7:37
• @AlexG, I will look into this. It is surprising that deprecated package, movie15, supports MPEG but the replacement package, media9, does not. Hopefully this is the primary problem in my implementation. – Steven C. Howell Nov 12 '15 at 13:18
• H.264 is much better than MPEG. Surprisingly small files at superior quality. – AlexG Nov 12 '15 at 13:21
• @AlexG, I am sure it is better. I do not think that warrants removing functionality, limiting the possible uses. I expect this could be related to changes in Adobe, the plugins, or with the goal that videos are viewable in more readers than just Adobe. – Steven C. Howell Nov 12 '15 at 14:02
• That is the case. The method implemented by media9 makes use of Flash which restricts the viable media formats to FLV (already obsolete), H.264, MP3 and SWF. – AlexG Nov 12 '15 at 14:19

Thanks to @AlexG for directing me to his solution for a closely related question. On closer review, there is no option to include mpg videos in movie15. This functionality has been deprecated together with media9. The newer package only accepts the more compressed, mp4 format.

I used ffmpeg to convert my mpg file to an mp4 file with the command:

ffmpeg -i 4x167_h5_k010.mpg 4x167_h5_k010.mp4


As a note, ffmpeg would not do the conversion until I had a standard aspect ratio. I had created the video using the Movie Maker extension of VMD. To obtain a 3x4 aspect ratio, I used the command display resize 1280 960, then regenerated the mpg video file.

Here is the final working example (with the video loop command):

\documentclass{beamer}

\usepackage{media9}

\begin{document}

\begin{frame}{}
\includemedia[
width=0.8\linewidth,
height=0.6\linewidth,
activate=pageopen,