Tag Archives: Time lapse video

One day in Zurich gone in seconds: time-lapse with Raspberry

Time-lapse videos are a great dramatic feature of many TV shows and movies; for example the entire opening titles of House of Cards is made using this technique.

Experiments like the one described in this post are easy to do with little equipment and still the final result is pleasing.

In its simplest form time-lapse consists in a series of snapshots put together to create a movie, more complex productions create a dynamic effect by having the camera moving while shooting. One important tip to remember is to choose a scene with many moving items. for this reason my short sunset video above is more interesting than the second one at the end of this article. Also, remember to check if you need any permissions to shoot in public places.

The Raspberry Pi (inside its original packaging) is powered by a USB portable power bank and the camera is held still by using helping hands (better than tape).

The Raspberry Pi (inside its original packaging) is powered by a USB portable power bank and the camera is held still by using helping hands (better than tape).

My set-up is improvised: a raspberry Pi, a USB power-bank, a Wi-Fi antenna, the camera module and “helping hands” to hold the camera steady (you can find these in any electronics shop). This setup can be also used to create a IP cam using a software called motion.

As mentioned the process is divided in two steps:

1) take pictures
You just need to open an ssh terminal in the Raspberry and digit the following code

raspistill -o myimage2_%04d.jpg -tl 30000 -t 43200000

where 30000 is the time in milliseconds between shots and 43200000 is the the duration of the session (12 hours). “&” at the end of the command tell Linux to run it in background. Alternatively you can use VNC and log in the Raspberry and open the command prompt.

2) put them together in a movie
After the pictures are taken we need to copy them in a more powerful computer for further processing. Naturally it is possible to use ssh or other methods such as ftp or telnet but I think the fastest method is to slot the SD card of the Raspberry into a reader connected to a Linux machine.

Next step is to create the video and to do that I used mencoder (see the Wikipedia entry for alternatives). Using the command prompt you have to position yourself into the folder where you saved the images and first create a text file containing the names of the images to stitch together:

ls -1tr > frames.txt

After that let the mencoder to the magic. One notable parameter is
fps frame per second. The higher the value the faster the scene will move and the shorter the move will be. I normally use 10 fps. You can try different values for example 20 fps for faster action.

mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 -mf type=jpeg:fps=10 mf://@frames.txt -o time-lapse.avi

Although this setup is bare-bone it allows to get some nice results. Further improvements can be to use better hardware and add features such as  a system to move the camera. Look for the  David Hunt time lapse controller for the best example I was able to find.