Timelaps with the Raspberry Pi camera board


Step 1 – Taking the time-lapsed photos

This command will take a photo every 60 seconds (60000 milliseconds) for 2 hours (7200000 milliseconds) resulting in a sequence of 120 images.

The “%04d” will result in a four digit number appearing in each filename.



Step 2 – Combine images into MP4 video

Once you’ve got your image sequence you will need a method to stitch them together. I decided to use “avconv”. You can install this useful library with the following command :

To construct the video file from your image sequence you use the command shown below. Although it appears on multiple lines for readability it should be entered as a single line on the command line :

The video will be the full resolution of the default image size (2592×1944).

To crop the images and create a more standard 1280×720 resolution video you can use the following command :

The “vf” option defines a video filter. In this case two filters which crop the incoming image to 2592×1458 and then scale them to 1280×720.

The “r” option tells avconv to create a video with a frames per second of 10. It appears twice to prevent avconv dropping frames that it thinks are similar.

The “crf” option tells avconv to aim for a quality level of “20″ which is a good starting point. Lowers values are better but will increase the file size.

The “-g” option sets the GOP value. The YouTube Advanced Encoding Settings page recommends that the GOP should be set to half the frame rate so this is set to 15.

One thought on “Timelaps with the Raspberry Pi camera board

  1. Pingback: Watch the sky (simple python ftp script) | Pieter @ Kraaima