OK, so using a Raspberry Pi with a PiCamera to make timelapse videos is hardly breaking new ground. Everyone’s doing it. But mine works pretty well, so I thought I’d share it.
Also, the other day it captured this:

Which is cool.
Anyway, I go a little further than just taking the pictures, I also have an automated process which:
- Annotates each image with Temperature, Humidity and Barrometric pressure readings taken during the day, as well as the date and time
- Merges the images into a single massive AVI
- Compresses the AVI into a MKV using x264 encoding
- Upload the resulting clip to Youtube
My humble setup looks like this:

Thats a Pi in the bottom half of an Element14 Pi Case, some “Helping Hands” to hold things in the right place and an ethernet cable.
Since the images are being moved to a CIFS share once they’re taken, I only use need a small 8GB SD-Card with Raspbian installed.
You can find the code on Github: https://github.com/Pesticles/PiCamera
The Pi itself does just 2 things. Take the pictures and move them to a CIFS share on my Debian based NAS.
The first script, /home/pi/still.sh, is run every minute by cron during the relevant times of day (6am-8:59pm right now, longer in summer):
The second script, /home/pi/transfer.sh, runs every minute by cron and moves the images from local storage to the CIFS share mounted on /DATA:
The crontab entry for these is thus:
* 6-20 * * * /home/pi/still.sh
* * * * * /home/pi/transfer.sh
This setup works very reliably. Even if the CIFS share goes away (as it does, often, when I’m tinkering with the NAS) the images just stack up on the SD card until it comes back.
Now we move on to the part that runs on the NAS. Obviously the parts related to the environmental data won’t be of much use to anyone else, but you can remove those reasonably easily.
This is the script which does all the heavy lifting, encode.sh, run by cron at 10:30pm each night:
The helper script process_image.py uses the Python Image library to add the date, time and environmental data to each frame:
The final helper script “upload_video.py” is provided by Google as part of the YouTube API. I won’t go into detail here, it’s worthy of a blog post all of it’s own.
Hopefully you can mangle the above to best suit your own needs. I’m very happy with the result. It’s reliable and turns out excellent quality videos. The only thing that’s lacking is automatically adding a soundtrack, but I’ll get to that too one day.
Luke.