Michael Maclean

Making timelapses with Linux

In other news, I’ve been spending far too much time recently with my camera. One thing I quite like doing is timelapse photography, which my camera (a Canon 400D) can’t do by itself, however I did acquire a cheap intervalometer from eBay, which together with my new tripod (a Velbon Sherpa 250, highly recommended) is quite for this kind of work.

I can’t, however, ever remember the command to create the timelapses. So, here’s a note to myself and anyone else who’s interested. If you have a folder full of .JPG files, with a sequential numbering scheme like most cameras have by default, you can run this command to create a video file using each JPEG image as a frame:

mencoder "mf://*.JPG" -mf fps=25 -vf scale -zoom -xy 1024 -ovc lavc -lavcopts vcodec=mpeg4 -o output.avi

This will output an MPEG4 file in the file output.avi. It will scale the images so that the video ends up being 1024 pixels wide, and set the height to keep the aspect ratio. It will also run at 25 frames per second. These values can be tweaked, depending on the effect you want.

I’ll update this post once I’ve figured out a few more things - I’d like to be able to do panning and zooming as well, and I know it’s possible, though perhaps a bit fiddly.