1

Copying the template offered by A.Grahn at the following post almost exactly,

Embedding videos using media9,

I ran the code below in pdfLaTeX:

\documentclass{article}
\usepackage{media9} 
\begin{document}
The video should appear just below.
 \includemedia[
    width=0.4\linewidth,
    height=0.3\linewidth,
    label='firsttry',
    addresource="C:/_Book/_Website/40631-H.264.mp4",
    activate=pageopen,
   flashvars={source="C:/_Book/_Website/40631-H.264.mp4"}
  ]{This is the poster text}{VPlayer.swf}
The video should appear just above.
\end{document}

I got no errors, and the resulting document looked just as expected, showing the words "This is the poster text" bounded by the text expected above and below it, but the video did not play. Instead I see only a cursor that's shaped like a magnifying glass which, when one clicks the poster area with it, causes that area to get bigger (as the cursor would imply), but does not play the video.

The video does indeed reside in the folder listed, and plays fine when one double-clicks it directly. It is apparently H.264 - at least that's the codec I chose for it in Handbrake, and MediaInfo tells me that it's "MPEG-4(Base Media / Version 2_: 218 KiB 2s 200ms" and further that it's "638 Kbps, 640*480 (4:3) at 15 fps, AVC (Main@L4.0) (CABAC / 4 Ref Frames)".

I get the very same (lack of) results whether or not I place the path names in quotation marks. Including &autoplay=true among the flashvars also did not change the results. I also get the same (lack of) results whether or not I specify VPlayer.swf or VPlayer9.swf.

Footnote: This surely doesn't matter, but I just discovered there has to be a line skipped after "The video should appear below" for the results to look as expected. (In posting this, I had collapsed the blank lines to make the code easier to read.)

  • I tried your code with a known *.mp4 which was placed in the exact same folder as the *.tex file and it runs fine. When I attempt to put the *.mp4 into any other folder then I am getting an error in the pdf of file not found instead of a black box. So, first try it with the *.mp4 in the same folder as the *.tex (and of course where the *.pdf will be. Second if still failing, rename the file without extra periods, any underscores, any spaces, or any non alphabetic characters. Third, if still failing, try step 1 and 2 with a known *.mp4 file other than this one. – R. Schumacher Jun 28 '15 at 4:28
  • Re the above comment by R. Schumacher: Renaming the video file without extra periods or underscores leads not to an error message as you experienced but to the result I described earlier. Placing the renamed video file in the same directory as the .tex file does lead to a slight improvement in that a 'Play Me' arrow now appears on the screen along with the poster text. But clicking the arrow does not cause the file to play; instead it leads to magnifying the area clicked. Maybe I need to be sure I have an H264 video. Unfortunately the only way I know to do that right now is via Handbrake. – Peyton Todd Jun 29 '15 at 14:24
  • You may also need to change the player you have specified as H264 is a subset of the mp4 family. Here is one other free player videolan.org/vlc. If you transcoded it using Handbreak and the original file was not correct, then the mp4 will be very wrong. Easiest next step is to verify that this video file actually be played. Best wishes, as this is like working in a house of mirrors. – R. Schumacher Jun 29 '15 at 14:37
  • Re the above comment by R. Schumacher: Yes, the video file plays perfectly in several players. So I downloaded the VLC player (vlc.exe), placed it in the same folder as the .tex file, and got the same results as before (poster text, magnifying glass cursor). Then I tried using xxx.exe as the video player and got an error since indeed no such file exists. Then I tried with a text file named xxx.txt that does exist, and I got the usual results (poster text, cursor as magnifying glass). But xxx.txt is not even a player at all! Also, if I drag the video file to VPlayer.swf itself nothing happens. – Peyton Todd Jun 29 '15 at 19:35
  • I wonder if the Vplayer.swf has the needed flash player available in your pdf viewer. See this bug report for details bugs.launchpad.net/lightspark/+bug/1246690 – R. Schumacher Jun 30 '15 at 0:07
1

Testing has shown that for the PDF built by pdfLaTeX to show video, an up-to-date version of flash player has to be installed. Before I updated flash, no video (not even the poster text) appeared in the PDF, but my video clip did appear (and does play) in the PDF built by pdfLaTeX after I ran (or re-ran?) a recent version of the flash installer. This did not resolve the question of whether the pdfLaTeX viewer is expected to show video, but I'll put that issue in a separate post.

Note that - at least according to my testing with the only three browsers I know to be installed on my PC (chrome, firefox & IE) - flash does NOT have to be enabled in one's browser, but merely installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.