/ _ \/ _ \(_) __/__  __ __ 
  / , _/ ___/ /\ \/ _ \/ // / 
 /_/|_/_/  /_/___/ .__/\_, /  
                /_/   /___/

RPiSpy Video Capture Unit

The RPiSpy Video Capture Unit is a basic script to record video files in a loop. The user can define the total number of files to keep and how long each file should last.


The script was designed to use a basic hardware/software configuration:

  • Raspberry Pi
  • Pi camera module
  • 8GB SD card (16GB recommended)
  • Standard Raspbian image
  • 1 button attached to GPIO7
  • 1 LED and resistor attached to GPIO4
  • 1 LED and resistor attached to GPIO11

In my test unit I used a BerryClip addon board to give me quick access to two LEDs, a switch and a buzzer.


  • - configuration settings
  • - file called on boot
  • instructions.txt
  • prepare_mp4.bat
  • - convert all h264 files to MP4
  • - main Python script

This script is run when the Pi boots. It looks for a network connection and only runs if it doesn't find one. This allows the Pi to boot normally when you have connected it to your network to copy video files.

This is the main Python script which does most of the work. It is called from when the Pi boots.

This file contain the settings used by It allows the user to adjust various parameters. If "/boot/" exists it is copied over the config file. The can be used to edit settings on a Windows PC which can see the /boot/ partitiion on the SD card.

This script provides an easy way to convert the recorded h264 files in the "/home/pi/rpispy_vcu/videos/" directory to MP4 files. It may take a while to convert depending on the total duration of the videos. It uses MP4Box.

Picamera Python Library

To start and stop video recording this script use the picamera Python library :

Additional information

Visit my site for more information :