3

I'm really having trouble to play back movies consistently, and I'm not sure where my workflow fails.

Usually desired behavior:

  • one slide with a still of the first movie frame. I would tell the audience what to expect.
  • movie starts playing after I click with my presenter and then loops until I go to the next slide

To achieve this, I manually take a snapshot of the first frame, and put it on one slide, then build the very same slide again, but with the movie instead of the snapshot and the option autoplay = true. I know it's not pretty, but I was not able to get movies to start consistently on mouseclick and with this workflow I get the desired behavior most of the time.

Nevertheless, I continue to have trouble with looping the movies. Sometimes, the movie just won't loop but stop after one run. Sometimes, the movie will loop, but there will be heavy artifacts from the second run on. Compiling the same document multiple times will produce different behavior. This is really a dealbreaker, because I cannot even rely on the fact that a movie that I got working will continue to work, I have to check every single movie after each compile which is of course very tiring.

I'm seeing the same issues with a number of different movies, not just with this one. Most common artifact is for the movie to turn into a green hue, but I have also seen pink, red and yellow stripes - or sometimes red lettering spelling the filenames of the included .tex files - which I doubt is coming from the movie itself, but looks more like a pdftex issue.

Source code, pdf, movie files and screenshot of the artifacts here: https://cloud.mpi-cbg.de/index.php/s/wqZ2Xx3kmI17XZZ When I play the pdf on my system, it loops but has artifacts in the 2nd run.

The example movie was downloaded from here: https://www.youtube.com/watch?v=ytqJjpdsNi8 then converted to h.264 using the "Handbrake" tool (I think it's essentially a GUI frontend for the ffmpeg codecs)

  • Mac OS X 10.11.6
  • TeX Live 2016
  • media9 0.76
  • Adobe Reader 15.23.20056.213124 (I know it's oldish, but every time I update Adobe Reader, something else in the videos breaks)

Conference talk is on Monday, so any help is highly appreciated ...

\documentclass[usenames,dvipsnames]{beamer}

\usepackage[english]{babel} % English spell check
\usepackage[utf8x]{inputenc} % utf8 support, also \usepackage[utf8x]{inputenc}
\usepackage{graphicx} % for graphics, subfigures etc., option pdftex is needed for incorporation of .pdf files
\usepackage{media9}
\usepackage{tikz}

\beamertemplatenavigationsymbolsempty % Turn off navigation bar at the bottom

\mode<presentation>{
    \usetheme{Warsaw}   
    \usecolortheme{seagull}
}

\begin{document}
\begin{frame}{Optical projection tomography on fixed samples}\begin{center}
        \vspace*{-1mm}\includegraphics[width=12cm, height=8.2cm]{Mouse.png}
\end{center}\end{frame}
\addtocounter{framenumber}{-1}
\begin{frame}{Optical projection tomography on fixed samples}\begin{center}
    \vspace*{-1mm}\includemedia[activate=pageopen,deactivate=pageclose,width=12cm, height=8.2cm,addresource=Mouse.mp4,
    flashvars={src=Mouse.mp4 &playbutton=none &loop=true &autoPlay=true}]{\includegraphics{Mouse.png}}{StrobeMediaPlayback.swf}
\end{center}\end{frame}
\end{document}
  • Not related to the problem, but you don't need \usepackage{graphicx} with beamer – user36296 Apr 5 '17 at 13:55
  • In fact, there is some issue with Mouse.mp4. It doesn't loop well in recent FlashPlayer versions. I will re-encode it using ffmpeg. – AlexG Apr 5 '17 at 14:16
4

playbutton is not a Flash variable of the player (Strobe) but an option to \includemedia.

The code produces a document in "presenter mode", as requested in the OP, for situations without access to a mouse. The still image is on the slide before the video. The video is loaded and auto-started when passing to the slide containing it. The example uses plain VPlayer.swf instead of Strobe.

If a mouse is accessible, playback can be controlled as follows: Press the mouse button over the running video in order to pause it. Give further explanations to the audience, if desired. Release mouse button to continue playback.


The handbrake (odd name for a media encoder, btw) encoded video does not loop well. This could be fixed by re-encoding it using ffmpeg:

ffmpeg -i Mouse.mp4 -vf scale="trunc(iw/2)*2:trunc(ih/2)*2" -c:a copy -c:v libx264 -profile:v high -pix_fmt yuv420p -g 30 -r 30 Mouse1.mp4

The re-encoded video Mouse1.mp4 and the TeX source below can be downloaded from and compiled on ShareLaTeX

\documentclass[usenames,dvipsnames]{beamer}

\usepackage[english]{babel} % English spell check
\usepackage[utf8x]{inputenc} % utf8 support
%\usepackage{graphicx} % for graphics, subfigures etc., option pdftex is needed for incorporation of .pdf files
\usepackage{media9}
\usepackage{tikz}

\beamertemplatenavigationsymbolsempty % Turn off navigation bar at the bottom

\mode<presentation>{
  \usetheme{Warsaw}    
  \usecolortheme{seagull}
}

\begin{document}

\begin{frame}{Optical projection tomography on fixed samples}
  \begin{center}
  \only<1>{\includegraphics[width=0.8\linewidth]{Mouse.png}}
  \only<2>{\includemedia[
    width=0.8\linewidth,
    playbutton=none,
    activate=pageopen,
    addresource=Mouse1.mp4,
    passcontext, %enable right-click menu 
    flashvars={
      source=Mouse1.mp4&
      loop=true&
      autoPlay=true
    }
  ]{\includegraphics{Mouse.png}}{VPlayer9.swf}}
  \end{center}
\end{frame}

\end{document}
  • I'm still seeing some artifacts when I download your movie & code from sharelatex and compile it locally :( Also, with your solution, I need to click into the video to play. I usually give presentations with a presenter/laserpointer, standing a couple of steps away from the computer. Going back to the computer and finding the mouse to click into the video is awkward. That means I need the video to play upon a mouseclick anywhere on the slide, because that's the only signal the presenter can send (i.e. "forward one slide"). That's why I used the workaround with the extra slide ... – Wiebke Apr 5 '17 at 15:11
  • I see. I will edit the answer to insert the "presenter" version. Concerning the artifacts, of which kind are they? Would you please try to update to the most recent Flash-Player plugin version? – AlexG Apr 5 '17 at 15:20
  • I just updated Flash Player to 25.0.0.127, but now the video doesn't loop anymore ... – Wiebke Apr 5 '17 at 15:26
  • Artifacts: (also edited in the original post, and screenshot uploaded to the owncloud folder) Most common artifact is for the movie to turn into a green hue, but I have also seen pink, red and yellow stripes - or sometimes red lettering spelling the filenames of the included .tex files - which I doubt is coming from the movie itself, but looks more like a pdftex issue? – Wiebke Apr 5 '17 at 15:32
  • 1
    Let us continue this discussion in chat. – AlexG Apr 5 '17 at 19:47

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.