Timelapse Video Recording Using a Rapberry Pi

RaspberryPi

Getting Ready…

For this challenge you will need:

  • A Raspberry Pi with Python 2 installed,
  • A PiCamera.

Follow the steps described on the following pages to make sure you have plugged the camera in your raspberry pi and that you have enabled it. Also make sure you have installed the picamera library.

Getting Started


timelapse

First we need to write a Python script to take and store a picture every “x” seconds. We will do this using an infinite loop.

To make sure we can exit the loop we will catch a keyboard interrupt (when the user presses CTRL + “C”. This will terminate the program.

The main variable used in this script is the timeInterval variable. Per default we set it to 5 seconds. You may want to change this depending on what you are recording and how long you intend to record it for.

Final Step


Now that we have all the pictures stored. We need to combine them into a video clip (.avi).

To do so we will use the following script, from Claude Pageau: Source: https://github.com/pageauc/pi-motion-orig

Share Button
Posted in Computer Science, Python - Advanced, Python Challenges Tagged with: ,

Our Latest Book