Which methods exist to animate a cartoon in latex and convert it into a video format like .mp4?


Creating an animation as multi-page PDF

One possibility to create a multi-page PDF with an animation is to use beamer. With its ability to use overlays it is easy to create image sequences like the following example:


\setbeamertemplate{navigation symbols}{}



    \begin{tikzpicture}[remember picture, overlay]

        \foreach \x in {0,5,...,180}{


                    (-3.7+\thepage/\insertdocumentendpage*18, 0.6) .. controls 
                    (-3.7+\thepage/\insertdocumentendpage*18, 0.6) and 
                    (-3.5+\thepage/\insertdocumentendpage*18, -0.5) .. 
                    (-1.5+\thepage/\insertdocumentendpage*18, {sin(\x)-2});


        \shade[ball color=red] (-3.7+\thepage/\insertdocumentendpage*18,1.4) ellipse (0.5 and 0.9);     





Converting the multipage PDF into a movie

To convert a multi-page pdf one can for example use the following bash script. It uses the convert command from ImageMagick, the Handbreak video transcoder and the video and audio software ffmpeg.

# clean up old video
rm test.mp4

# convert to png images
# is called something different in windows, `magick convert` ?
convert -density 160 test.pdf test.png

# convert to video
# modify -r 10 to adjust the speed in which the individual images are shown
# combine the video with music starting at second 16: -ss 00:00:16 -i FunnyMusic.mp3  
ffmpeg -r 10 -ss 00:00:00 -i test-%d.png -ss 00:00:16 -i FunnyMusic.mp3 -shortest test_raw.mp4

# repair video, add preview image etc.
HandBrakeCLI --crop 0:0:0:0 -i test_raw.mp4 -o test.mp4

# clean up
rm test-*.png
rm test_raw.mp4

# view :)
open test.mp4


enter image description here


An example of some animated cartoon scenes, most using the same technique as described above, can be found at https://vimeo.com/305374856

enter image description here

(the source code is available from https://github.com/samcarter/Extravanganza2018)

  • 1
    Impressive... impressive... CRAZY! – Daniel Dec 9 '18 at 23:10

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.