[Tex/LaTex] Is it possible to produce a video from LaTeX source, ideally including other video files

beamermedia9multimediaoutput

I know that it is possible to include video to a LaTeX document using the media9 package.
The downside is of course that not all viewers support this feature.

I am going to do the opposite:
I created a presentation using the beamer class and I want to be able to present this using a SmartTV. Since the TV doesn't handle PDF, I need to convert the PDF to a video file.

There are different tools available for this task but I was wondering if

  • it is possible to produce a video file from LaTeX directly (nothing fancy, just change the slide after a fixed amount of time)
  • such an approach could handle video embedded to the presentation (skipping to the next slide after the video has finished)
  • there is another solution to achieve this besides splitting the presentation where videos should be embedded, compile the parts to PDF, convert the PDF files to video files and paste those videos with the ones that should have been embedded

I am open to all suggestions but ideally I want to be able to automate this process using some kind of Makefile or the like. So command line solutions are preferred over GUI and/or web solutions.

Best Answer

Your best bet would be to convert the pdf to a series of images probably using imagemagick's convert routine, then use ffmpeg to assemble them into a video. Both tools are free and cross-platform.

Stack Overflow has more detail - you could basically run the contents of the 2 php exec commands in the answer from the command line.

Edit: I think it would be necessary to use a script to figure out where to insert the video - either:

  • In my limited use of Beamer (simple static slides) I would be able to count the \begin{frame}s to count the slides, then look out for the command that includes the video. You could then use this to drive ffmpeg.

  • It also looks possible to parse the .nav file - this may be simpler, but I can't get media9 working here at the moment, so don't know whether it inserts anything into the .nav or the .aux.

The common point is that ffpmeg can do the heavy lifting by combining images and (dissimilar) video files.

However, if this was a one-off, without too many videos, I would be inclined to split the PDF, and use ffmpeg to combine PDF1, video1, PDF2, video2 etc. by hand, despite my inclination to script as much as possible.

Related Question