# Embedding with a video with media9 across slide transitions

Within one beamer frame, I want a video clip to play once. I then want text to appear and the final frame of the clip to remain visible. To avoid clicking the video, I use the activate=pageopen option inside of the media9 \includemedia funtion. As a result, when the text appears, the video replays since it is embedded into that slide as well.

I'm open to any solution that accomplishes the goal above, but one thing I tried is to include the actual video on only the first slide and, for subsequent slides, include a "video" which is just the final frame (without sound) of the actual video. Here is a MWE (except for the missing video files of course):

\documentclass{beamer}
\usepackage{media9}

\begin{document}

\begin{frame}{Video and Text Frame}
\only<1>%
{%
\includemedia%
[%
width=\textwidth,%
height=.5625\textwidth,%
activate=pageopen,%
deactivate=onclick,%
flashvars=%
{%
source=VideoClip.mp4&%
autoPlay=true&%
loop=false%
}%
]%
{}{VPlayer.swf}%
}%
\only<2>%
{%
\includemedia%
[%
width=\textwidth,%
height=.5625\textwidth,%
activate=pageopen,%
deactivate=onclick,%
flashvars=%
{%
source=OneFrameVideo.mp4&%
autoPlay=true&%
loop=false%
}%
]%
{}{VPlayer.swf}%
}
\onslide<2>{Text that appears}
\end{frame}

\end{document}


The problem is that the videos, particularly the single frame video, take a moment to appear. The result is a very ugly slide transition as the first video momentarily disappears before the second video replaces it. Is there a way to make the appearance of the videos more seamless? If I click through the pdf once, the ugly gap disappears (because the pdf viewer has already loaded the videos?), but it ruins the auto play feature on the frame in question and in other unrelated frames.

I also tried using \includegraphics with an image of the last frame, but the sizes were a bit off (making for a transition that is ugly in a different way) no matter how I attempted to set the width.

• Put the things on different frame should work. – vi pa Dec 4 '19 at 10:36
• It takes a moment to load the one frame video even if it is in a separate frame. Thus the transition is still ugly. I do see that your method allows me to skip ahead to the one frame videos and so "play" them in advance, which, in a way, fixes the problem. Unfortunately, I need 10 different videos so skipping ahead to all these slides before I play the presentation is pretty clunky. – David Paige Dec 5 '19 at 2:04

For me this work:

\documentclass{beamer}
\usepackage{media9}

\begin{document}

\begin{frame}{Video and Text Frame}
\includemedia%
[%
width=\textwidth,%
height=.5625\textwidth,%
activate=pageopen,%
deactivate=onclick,%
flashvars=%
{%
source=VideoClip.mp4&%
autoPlay=true&%
loop=false%
}%
]%
{}{VPlayer.swf}
\phantom{Text that appears}
\end{frame}
\begin{frame}{Video and Text Frame}
\includegraphics[
width=\textwidth,%
height=.5625\textwidth,%
]{lastFrameVideoClip}
Text that appears
\end{frame}

\end{document}


I've get the lastFrameVideoClip.jpg with ffmpeg with this istruction

• Thanks! Going the \includegraphic route in a separate frame does indeed fix the size issue. The image itself still changes slightly (i.e. the last frame that the video ends on seems to be slightly different then the image produced by ffmpeg). Did the same thing happen to you? – David Paige Dec 6 '19 at 3:02
• Yes the same thing. The lastFrameVideoClip.jpg has a higher resolution. – vi pa Dec 6 '19 at 11:59
• I see. Thanks for clearing everything up! – David Paige Dec 11 '19 at 14:21