Flipbooks

From XPUB & Lens-Based wiki

Summary

This recipe will enable any aspiring experimental publisher to cook up some flipbooks out of short video sequences, using only a couple of command line tools.

Flipbook 101

A flipbook is a book with a series of pictures that vary gradually from one page to the next. When the pages are turned rapidly, it simulates an animation

Recipe

To start off, you'll need to install a couple of tools (instructions for Linux):


$ sudo apt-get install imagemagick ffmpeg


Enter the folder your video is located in, then run the following commands:

  • to generate frames from the video, give the desired frame rate (-r 30) and format the output files (frames%09d.jpg);


ffmpeg -i video_name -r 30 frames%09d.jpg


  • in order to save some paper when printing the flipbook, you'll want to generate jpgs that include several frames in one image, in order. You can give the desired size of the frames and the spacing between them ('640X>+10+10), as well as the number of frames per page (-tile 1X3);


montage -geometry '640x>+10+10' -tile 1x3 /*.jpg test%04d.jpg


  • to generate one pdf that includes all and only the newly generated jpgs;


convert test*.jpg test.pdf


  • alternatively, you can simply move the jpgs generated in the second step into a new folder, enter that folder and run the convert command there.