Turn Raspberry pi into a CCTV
- Start recording on capture of movement.
- It uses ring buffer to include recordings
- Automatically merge records into 1 file on capture of continuous movements.
- Keep its recording folder(/home/pi/cctv_capture) under 1GB by removing oldest files.
- Raspberry compatible camera connected to its camera connector. Other interfaces like GPIO is not tested but may possible somehow...
sudo pip install numpy
sudo apt-get install python-picamera
detailssudo raspi-config
and enable camera.- Git installed system that you'll use as a surveillance monitor. On Windows, git bin folder needs to be registered in environmental variable path. The getall script uses the scp.exe in it.
git clone https://github.com/chidea/piCCTV.git && cd piCCTV
sudo python cctv.py for one-time run
sudo sh install.sh
to install it as system service. In this way, you can stop, start, restart the service withsudo service cctv [restart/start/stop]
later.- On your monitoring machine, do the same on line number 1 and
python getall.py <address of your raspberry pi> [file name or filter]
If you're using Windows for it and do not want python to be installed, usegetall <address of your raspberry pi> [file name or filter]
instead (utilizing getall.bat).
- Simply leave it blank or
*
to get all videos captured. "2015\ 05\ 18*"
to get all videos captured on May 18th, 2015.
ffplay can be used to play it directly or convert it with ffmpeg.
You can be noticed for CCTV status messages by MQTT. It's utilizing paho python client.
sudo pip install paho-mqtt
sudo python mqtt_cctv.py <topic> [broker address] [id] [pw]
Sending a message record
to topic /control/<topic>
will record for several seconds as same as capturing a motion.
If you want to install this version as service, after installing the service as instruction above, overwrite the file /home/pi/cctv.py with it and restart the service.
mv mqtt_cctv.py /home/pi/cctv.py && sudo service cctv restart
Feel free to take a look at cctv.py and apply the CV on it.