2

In theory, media9 should be able to embed MP4 movies into a PDF. The document is compiled fine with PDFlatex, but I get a blank screen when opening it in Adobe PDF on Windows 10.

Below is a minimal TEX example. I created the MP4 movie with Kazam in Ubuntu 18 as a screencast of a couple of seconds, that outputs with codec H264 MPEG-4 AVC part 10 (avc1).

\documentclass{article}
\usepackage{media9}

\begin{document}
\begin{figure}
\includemedia[
     width=\textwidth,
     height=0.56\textwidth,
     addresource=test.mp4,
     flashvars={
         source=test.mp4
         &autoPlay=true
     }
]{}{VPlayer.swf}

\includemedia[
     width=\textwidth,
     height=0.56\textwidth,
     addresource=test.flv,
     flashvars={
         source=test.flv
         &autoPlay=true
     }
]{}{VPlayer.swf}
\end{figure}
\end{document}

If I convert the MP4 to FLV using ffmpeg, then it works, but it takes 5 times more space on disk, and in addition much worse resolution. I am curious if there is a way to fix the MP4 inclusion, as the H264 codec is said to be supported by media9 and Flash Player.

ffmpeg -i test.mp4 test.flv

Any help is welcome. Thanks.

1

I found a workaround, namely to postprocess the .mp4 output from Kazam following the solution of this post, but keeping the format as mp4, not flv.

Below the code to make the MP4 movie to work with media9 and Flash player:

ffmpeg -i test.mp4 -profile:v high -pix_fmt yuv420p -g 300 test_postprocess.mp4

Still confusing why this is needed. Is it a bug in kazam or in media9, or in flash player?

  • 1
    It's FlashPlayer. It is quite picky about codecs. – AlexG Nov 14 '19 at 6:23

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.