Working with the Raspberry Pi camera module

Time-Lapse Photography

A really fantastic way to make use of the Raspberry Pi camera is for time-lapse photography – taking pictures at regular intervals and then stitching them together into a video. You have probably seen this technique many times in wildlife videos.

It is really easy to use the Pi camera for time-lapse photography with the parameter -tl. For example, to take a picture every 10 seconds for an hour, type:

$ raspistill -o test_%03d.jpeg -tl 10000 -t 3600000

I recommend executing the preceding command from within a directory called /home/pi/timelapse or similar, as it will make the next part much easier if only the time-lapse photos exist in the directory.

The preceding command will generate 360 images. The %03d allocates 3 decimal places for the number in the filename. In this case the filenames will start with test_001.jpeg and end with test_360.jpeg. If you are doing a time-lapse over a longer period, you would probably need to increase this to %04d or %05d to accommodate a 4- or 5-digit number in the filename.

Stitching Them Together

To stitch the time-lapse images into a video, you need mencoder:

$ sudo apt-get install mencoder

You will make a list of all the files to pass through to mencoder later. You need to be within the /home/pi/timelapse directory (or wherever you saved all the pictures) and then type:

$ ls *.jpeg > timelapse.txt

Then, create an 1080p HD video of the images using the following command:

$mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mftype=jpeg:fps=24 mf://@timelapse.txt

You can change the name of the output file by changing timelapse.avi to another name.

Once you get to know the time-lapse photography option, think of all the creative videos you can make! And what about creating a battery-powered time lapse camera rig using a model A Raspberry Pi, a camera module, and a large battery? Add a solar panel and place it in a remote location, and you could be snapping for days on end.

Buy this article as PDF

Express-Checkout as PDF

Pages: 2

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Using the RPi Cam Web Interface

    You can access and control the Raspberry Pi camera module from your favorite browser using the RPi Cam Web Interface software.

  • Snapshot

    The remarkable Raspberry Pi has spawned a myriad of supporting projects – Android apps, program libraries, specialized Linux distributions, and an assortment of hardware accessories. The rapid changes within these projects is testament to the excitement and enthusiasm that developers around the world have given to the Raspberry Pi.

  • Building a Motion Detector using Scratch GPIO server

    As of the Raspbian Jessie release, Scratch provides easy access to the Raspberry Pi's GPIO pins. This project incorporates the new GPIO server to build a motion detector.

  • Build your own infrared camera

    The human eye is sensitive to a narrow range of wavelengths that make up the visible light spectrum, but not to the infrared range. However, a Rasp Pi outfitted with an IR camera module offers a low-cost solution for taking photographs using infrared light.

  • SunRover Part 4 – Adding a Pi Camera and Diagnostics System

    A Raspberry Pi Camera module and a diagnostics system allows SunRover to see and check that all systems are go.