Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm really new to LaTeX and I'm not very good with computers. I'm trying to put videos into my PDF's. I'm using media9 and I've got the following going so far.

\usepackage{media9} 

 \includemedia[
    width=0.6\linewidth,
    height=0.45\linewidth,
    addresource=/Users/tristanjohnson/Library/texmf/tex/latex/misc/media9/Ruinn.MP4,
    activate=onclick,
    deactivate=onclick,
  ]{Movie}{Ruinn.MP4}

\mediabutton[ mediacommand=some_dice:playPause, overface=\color{blue}{\fbox{\strut Play/Pause}}, downface=\color{red}{\fbox{\strut Play/Pause}}
]{\fbox{\strut Play/Pause}} \mediabutton[
mediacommand=some_dice:setSource [(random.mp4)] ]{\fbox{\strut random.mp4}} \mediabutton[
mediacommand=some_dice:setSource [(cube.mp4)] ]{\fbox{\strut cube.mp4}}

I merely copied and pasted the mediabutton stuff. When I hit "Typeset" it runs without any errors. But when I click the play button nothing happens. I want the video embedded in the PDF so other people can see the video without having to have the file locally. Help?

share|improve this question
    
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). –  Corentin Mar 14 '13 at 18:27
    
Your media file Ruinn.MP4 resides at an uncommon place, probably within the TeX installation. Don't clutter a TeX installation with user generated documents and related files. Keep user data separate from software. –  AlexG Mar 15 '13 at 8:58
    
What do you need the media buttons for? –  AlexG Mar 15 '13 at 10:06
add comment

1 Answer 1

Media files to be played back are usually embedded into the PDF (although playing files from remote URLs via http and rtmp protocols is supported too).

Media9 implements playback of media files inside PDF documents using the FlashPlayer plugin in Adobe Reader. This feature is currently available on the Windows and OSX platforms.

Two prerequisites are necessary: The media file (a video in the MP4/H.264 or FLV formats) and a media player in the Flash format (e. g. VPlayer.swf provided by Media9).

The latter is embedded by setting it as the last argument of \includemedia, while option addresource=... instructs LaTeX to physically embed a video file into the PDF.

Furthermore, VPlayer.swf needs to be told what to play. Flash applications are configured via FlashVars. For this, \includemedia provides the flashvars option. The most important FlashVar of VPlayer.swf is source=... which sets the media source. More FlashVars exist, e. g. for setting the sound volume, or loop which tells VPlayer.swf to infinitely replay the video. Refer to the Media9 documentation for other configuration options.

It is a good idea to place media files for embedding into the directory of the document you are about to write, or into a sub-directory of it. Lets assume Ruinn.MP4 is in the subdirectory videos. A minimal working example would read:

\documentclass{article}
\usepackage{media9}

\begin{document}

\includemedia[
  width=0.4\linewidth,
  height=0.3\linewidth,
  activate=pageopen,
  addresource=videos/Ruinn.MP4,
  flashvars={source=videos/Ruinn.MP4}
]{}{VPlayer.swf}

\end{document}

Note that the paths to the video file used with the addresource option and with the source FlashVar must be identical. Further note, that MP4 is only a container file format for video. The video data inside the file must be encoded with the H.264 codec. Another option is the FLV file format.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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