How To: Stop Motion in Ubuntu

I took a photo every 2 minutes while driving across the US (I velcroed a piece of wood with a bolt of the right size mounted in it to my dashboard, and screwed my camera onto it.) That resulted in 1456 JPG images, equating to 48 hours of driving time (this is not strictly accurate; my camera, on the stock canon firmware, only takes 100 photos in stop motion mode before needing to be restarted; on a couple of long afternoon sprints the camera stopped taking photos without my noticing. I’m going to replace the firmware soon with CHDK.)

When I downloaded the photos from my camera, they were named: img_3074.jpg … img_4530.jpg. Because I was going to pass them through ffmpeg, which is particular about sequenced filenames, I used krename (sudo apt-get install krename, if you don’t have it already), and renamed them 0001.jpeg … 1456.jpeg (using the pattern #### in the destination file name).

All that remains after this is to run them through ffmpeg:

ffmpeg -r 10 -b 1800 -i %04d.jpeg -s 800x600 test.mp4

Notes:

  • -r controls frame rate; I’m using a frame rate of 10
  • -i is the input file name; here I’m saying “take all jpegs whose name is 4 digits, in sequence”
  • -b is the bitrate. 1800 is pretty low quality but results in a manageable file
  • -s is necessary if your photos are landscape; ffmpeg assumes they’re portrait by default

Useful links:
[ffmpeg 1 -> http://howto-pages.org/ffmpeg/#multiple]
ffmpeg 2

Trackbacks/Pingbacks (2)

  1. Coast to coast in 3 minutes | Flavor 8 on Saturday, October 11, 2008 at 8:46 pm

    [...] How To: Stop Motion in Ubuntu [...]

  2. Effets photo et vidéo sous Linux (suite) | openSYD on Thursday, September 24, 2009 at 2:34 pm

    [...] compiler une série de photos en vidéo, nous utiliserons ffmpeg en suivant cet article du site Flavor [...]