Creating time-lapse videos

This guide shows you how to create high-definition time-lapse videos from series of still pictures, tailored towards Flickr, and using only free and open source tools available on most operating systems (although I’m not sure about Windows). If you’re just here for the meat, or you’re already photographing in 1280×720, you can go straight to the code or example.

Cropping

High resolution is not everything, but it’s a useful substitute for a good zoom lens if you’re going to show the final result in a lower resolution than your camera produces. This is very common, and will probably continue to be common for a while. CCDs quickly surpassed desktop screens in resolution (and are likely to continue that way), and showing a full-screen, full-resolution video without stuttering is more than many desktop computers are able to do today.

Flickr staff recommend 640×480 (SD) or 1280×720 (HD) resolution with 25/30 FPS. Anything else I presume will be resized and slowed/speeded up. Since most digital cameras nowadays have much higher resolutions than these, I’ll base the instructions on 1280×720, 30 FPS, but it should be easy to adapt them if you want.

If you want to have as much surface area as possible for your video, you should crop it to fit the aspect ratio (16:9 for 1280×720). This is easy in GIMP:

  1. Open the image
  2. Select the crop tool
  3. Set fixed aspect ratio 16:9
  4. Move and resize the crop field until it fits your purpose. This is where you have the chance to get rid of that random stuff in the corners that you don’t want to leave in the finished movie.
  5. Note the crop position (e.g., x=0, y=495) and size (e.g., 4752×2673) in pixels for later.

Resizing

Your images are probably still larger than 1280×720 pixels, so we’ll need to resize them as well. We’ll force the aspect ratio (! below) to avoid any rounding errors which might occur since our image size is most likely not a multiple of 1280×720 pixels.

Do it!

Now make sure you have a backup! Then replace the crop values with your own, using the geometry <width>x<height>+<x position>+<y position>:

mogrify -monitor -crop 4752x2673+0+495 -resize 1280x720! /path/to/*.jpg
mencoder -nosound mf:///path/to/*.jpg -mf w=1280:h=720:type=jpg:fps=30 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=9000000:mbd=2:keyint=132:v4mv -o time-lapse.avi

Example

Howto: Timelapse video from photos

It’s amazing what shell tools can do: Flickr accepts HD video (720p, or max 1280×720) up to 30 FPS, so I tried to create one within those limits from the high resolution photos from today’s sunrise. Turns out to be incredibly easy with free tools on Linux:

  1. Resize to 720 pixels height (if your images are still wider than 1280 you’ll have to replace x720 with 1280 (without the “x“): mogrify -resize x720 *
  2. Find the width of the images, and plug that into the following command instead of 1080.
  3. Create the video: mencoder mf://* -mf w=1080:h=720:fps=30:type=jpg -ovc copy -oac copy -o output.avi

The result