1

I've stumbled across an issue when trying to embed a video in my beamer presentation using the media9 package. Strangely, it embeds it correctly and displays it properly for the first iteration. However, after the first iteration when its supposed to loop, it has a weird behaviour where the first part of the media isn't displayed but the second part is. The looping process still works fine though.

I'm using the latest version of Acrobat Reader which should properly work with embedded videos.

What I'm currently using:

\includemedia[
  width=\linewidth,
  totalheight=5cm,
  activate=pageopen,
  deactivate=pageclose,
  passcontext,  %show VPlayer's right-click menu
  addresource=presentation/assets/videos/seq2seq_1.mp4,
  flashvars={
    %important: same path as in `addresource'
    source=presentation/assets/videos/seq2seq_1.mp4
    &autoPlay=true 
    &loop=true 
  }
]{\fbox{Click!}}{VPlayer.swf}

The video I'm trying to embed is: https://jalammar.github.io/images/seq2seq_1.mp4

What I've tried so far:

Are there any workarounds or tricks I could use? I think I'm using the package correctly but it seems that something about these specific mp4s (encoding or something) causes this weird behaviour.

  • 1
    I re-encoded the video using ffmpeg, with a higher number of keyframes (every 10th video frame). This fixed the looping issue for me: ffmpeg -i seq2seq_1.mp4 -c:a copy -c:v libx264 -profile:v high -pix_fmt yuv420p -g 10 -r 30 seq2seq_2.mp4 – AlexG Nov 17 '19 at 18:16
  • 1
    Or, if you have the single frames as graphics files, preferably in a vector format, you could use pkg animate which may work more reliably. – AlexG Nov 17 '19 at 18:33
  • 1
    @AlexG re-encoding also works for me, thanks! – Robin Schmidt Nov 17 '19 at 21:39
1

Based on the comment from @AlexG:

"Re-encoding the video using ffmpeg, with a higher number of keyframes (every 10th video frame) fixes the looping issue":

ffmpeg -i seq2seq_1.mp4 -c:a copy -c:v libx264 -profile:v high -pix_fmt yuv420p -g 10 -r 30 seq2seq_2.mp4
|improve this answer|||||

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.