raspberry pi timelapse

Raspberry pi timelapse example

Bellow are notes how to create a raspberry pi timelapse video in MP4 format. This command will take a photo every 60 seconds (60000 milliseconds) for 2 hours (7200000 milliseconds) resulting in a sequence of 120 images. Depending on what quality and time range you want to take pictures it advisable to use a USB stick / storage or samba drive to store those images.

raspistill -o myimage_%04d.jpg -tl 60000 -t 86400000

Variations which I tried out:

5min gap between snapshot for 8h

sudo raspistill -o myimage_%04d.jpg -tl 300000 -t 28800000

5min gap between snapshot for 12h

sudo raspistill -o myimage_%04d.jpg -tl 300000 -t 43200000

5min gap between snapshot for 24h

sudo raspistill -o myimage_%04d.jpg -tl 300000 -t 86400000

Compiling snapshots into a MP4 video:

Install avcovn:

sudo apt-get -y install libav-tools

Compile snapshots in original snapshot resolution:

avconv -r 10 -i myimage_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 timelapse.mp4

Compile snapshots in 1280×720 resolution:

avconv -r 10 -i myimage_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 -vf crop=2592:1458,scale=1280:720 timelapse.mp4

Be aware that this is pretty time consuming, so I used bellwo mentioned screen and left the compilation during the night.


Its advisable to use screen or tmux combined with the above commands to keep the command running in background even you get disconnected from the ssh session.

Install screen:

sudo apt-get install screen

Combine screen with raspistill & :

sudo screen -S timelapse  -d raspistill -o myimage_%04d.jpg -tl 300000 -t 28800000


Following video was created with raspberry pi and camera module taken in summer 2013.

raspberry pi timelapse

Category: Raspberry pi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.