Some time ago I asked this question How to include a movie in a PDF? Step by step instructions. (I tried everything documented there, and links therein. I can't find the combination of tools to be able to playback embedded movies in a PDF viewer in Linux.)
This time I am going to be more direct: Was anyone, with a certain combination of tools and viewer, able to create a PDF from TeX with an embedded movie and play it back in a Linux viewer (for example some version of Acrobat)?
If, so what package, tex version, acrobat version was used?
EDIT 2014
Thanks to @AlexG, great advances have been made regarding the inclusion of movies and in particular the playback in Linux. It is just a pity that Acrobat for Linux is at its end of life (not so much for Adobe but because nobody is picking up the torch for embedded media).
This edit simply summarizes a working solution that is illustrated by defining a command \includemove[dimensions]{moviewithoutextension}, that produces movies that can be played back in Acrobat 9.4.1 (Linux), Acrobat for Windows and Mac and that fallbacks to external players (and a still picture) in other PDF viewers.
Assumptions:
- You have a copy of jw-player 5.10 (
not 5.9 or 6.x) in your local directory and it is namedplayer.swf. (from here http://developer.longtailvideo.com/trac/browser/tags/mediaplayer-5.10, documentation here: http://www.longtailvideo.com/support/jw5/31138/configuration-options) - You have
ffmpegversion 2.1.4. You have a copy of your movie in the
mp4format. Any movie can be converted in this wayffmpeg -i $MYMOVIE.vid -vf scale="trunc(iw/2)*2:trunc(ih/2)*2" -c:v libx264 -profile:v high -pix_fmt yuv420p -g 25 -r 25 $MYMOVIE.mp4ffmpeg -i $MYMOVIE.vid -qscale 0 -vcodec libx264 -x264opts keyint=25 $MYMOVE.mp4A preview image with the same name but extension
png. This can be achieved by converting your movie in this way and taking an snapshot:ffmpeg -i $MYMOVIE.mp4 -ss 00:00:2.1 -f image2 -vframes 1 $MYMOVIE.png[optional] A PDF image with the same name but
pdfextension to replace the PNG preview in case Flash content is not active.You are OK using the packages
hyperref(andmedia9of course).[for playback] You have Acrobat 9.4.1 (for playback in Linux) or more modern versions in other systems.
- [for playback] For other PDF viewers: the extension
mp4is associated with some application and the movie is distributed with the PDF.
Limitations (of my poor implementation, not of media9)
- Only
widthand/orheightcan be specified as options. - No other player than
jw-playercan be used (options are hardcoded in the command definition). - It assumes a lot of defaults regarding the behavior of the embedded player.
- [For fallback] The definition tries it best to have a nice fallback mode for other viewers, and you have to choose (see the code) between embedding the movie or having an external file.
- [For playback] I don't know if it works in all viewers, it works at least in Acrobat 9.4.1 (Linux) and Evince 3.10.3 (Linux). I saw it work in Acrobat X in Windows and Mac after a "security message" confirmation.
Given this conditions, the following document that includes the definition of \includemovie and summarizes a working solution.
\documentclass{article}
\usepackage[noplaybutton]{media9}
\usepackage[colorlinks]{hyperref}
\usepackage{attachfile2}
\newcommand{\includemovie}[2][]{
\includemedia[
#1,
activate=pageopen,transparent,
addresource=#2.mp4,addresource=#2.png,
flashvars={
file=#2.mp4&image=#2.png&
stretching=uniform&start=0&
screencolor=white& %improves render in light backgrounds
controlbar.position=over&controlbar.idlehide=true&
autostart=true&repeat=always&smoothing=true
%&bufferlength=10 % may improve repetition of short videos
}
]{ % for disabled content (in most cases this is fallback)
\begin{tabular}{ll}
\mbox{
% \href{run:#2.mp4} % for not embedded fallback
\textattachfile[color={0 0 0}]{#2.mp4} % for embedded fallback
{\texttt{|\kern-.23em>}} % poor play button
} & \raisebox{-\height}{\includegraphics[#1]{#2}}
\end{tabular}
}{player.swf}
}
\begin{document}
\includemovie[width=5cm]{MYMOVIE} %no extension!
\end{document}
(note: you may benefit by producing JPEG snapshots, PNG are usually very big, sometimes as big as the whole movie)



ffmpegcommand line to produce a usable video file, item (3), may need to be adjusted. See http://tex.stackexchange.com/a/141765. – AlexG Apr 15 '15 at 11:09-profile:v high -pix_fmt yuv420pshould be added to theffmpegcommand line to get a usable MP4 video file (item 3 of your list). – AlexG May 20 '15 at 07:58ffmpegis complaining thatqscaleis ambiguous. Do you have a complete line to suggest? (feel free to edit). BTW, I never had problems using this command line (in spite of not understanding some of the options). – alfC May 20 '15 at 08:01libx264versions seem to use a different profile/pix format which is not compatible with Flash Player. – AlexG May 20 '15 at 08:05