I am attempting to find out how to embed a flv video in a pdf file created using plain TeX and pdfTeX. I was successful at manually (via Adobe Acrobat's menu: Tools->Multimedia->Video Tool) embedding a flv video clip into an existing pdf. Then examined the pdf file in a text editor (vim) to see if I could figure out the code that needed to be added to embed a video. Although I was able to identify some of the lines associated with the embedding, I am clueless as to how to achieve the embedding using plain TeX and pdfTeX. Would appreciate any pointers.
Thanks.
PS: @AlexG 's response does give me what I was looking for. However, I do have a follow up question. I attempted to write the follow-up as a comment, but was not able to format the follow-up properly. So here it is:
Toward the end of the code, what's the need for the "\setbox0=…" and the "\hbox to …" lines? Commenting these two lines did not seem to affect the solution:
top
%\setbox0=\hbox{ }\immediate\pdfxform 0%
\vbox to 25.6mm{%
\pdfannot width \videowidth depth \videoheight height 0pt {
/Subtype/RichMedia
/BS <</W 0/S/S>>
/Contents (embedded video file:\videofile)
/NM (rma:\videofile)
/AP <</N \the\pdflastxform\space 0 R>>
/RichMediaSettings \the\pdflastobj\space 0 R
/RichMediaContent \rmcontent\space 0 R
}}%
%\hbox to \videowidth {\vbox to \videoheight {}\hss}%
bottom
The above ending results in the video showing up placed vertically between the words top and bottom.
Best Answer
The following example defines
\embedvideo
. It uses the same media embedding method as themedia9
LaTeX package. Video files in the MP4/H264 and FLV formats are played back within the video player component VPlayer.swf shipping withmedia9
.See the media9 manual on how to configure
VPlayer
via FlashVars, which are passed as the 3rd argument of\embedvideo
.The video player can be controlled by left mouse button press (pause) and release (play/resume), via the context menu accessed by right mouse button click and via the keyboard (see context menu for keys).
To answer the follow-up question:
The lines
\setbox0=...
and\immediate\pdfxform 0%
produce a poster text for the inactive video. The text (video file name) is put in a box and subsequently distilled into a so-called Form-XObject. The latter is bound to the RichMedia annotation using the/AP
entry. Without a poster text, AR displays an ugly box with a "?" inside if the video is inactive.