Shinobi (https://shinobi.video/) is an open-source CCTV software which natively supports the Raspberry Pi. If you've ever futzed around with commercial CCTV software, you'll see instantly how much better Shinobi is.
You can read more about my setup on my blog here: http://www.heystephenwood.com/2018/08/s ... i-3-b.html
I'm able to support 2x 1080p@30fps and 2x 720p@30fps cameras on a single Raspberry Pi 3 B+ with active cooling. I can probably push it harder but I ran out of cameras.
The biggest bottleneck for me was storage. Thankfully I have a NAS where I can upload/store all of the captured video. Even a 64GB card fills up fast because of how much traffic some of my cameras receive.
The setup
My setup includes 4 cameras: 2x 1080p@30, and 2x 720p@30. I have them monitoring for motion and recording. The RPI is able to handle this workload with surprisingly little power usage.
In order for this setup to work, there's a few conditions that must be met:
- No transcoding. It's simply too CPU intensive even with hardware-accelerated h264_omx encoder. For any recording/streaming you'll need to set the video codec to "copy" (or possibly the jpeg API).
- Depending on the camera quality settings, you'll need to bump the GPU memory share up to 256MB. Even to me this seemed too high, but without it I was getting mmal decoding errors with more than 2 1080p@30 NVR camera.
- For any decoding you'll need to use the hardware-accelerated h264_mmal codec. Without specifying this codec there will be too much CPU usage. Using MMAL ensures that the heavy lifting of deciding the h264 stream is done on the GPU.
- Real 2.5a power supply. Your RPI needs all of it.
- (Optional) Active cooling. My RPI case has a small fan hooked up the 3v power supply. I have small heatsinks attached to the SoC.
Code: Select all
# ffmpeg
ffmpeg version 3.2.10-1~deb9u1+rpt2 Copyright (c) 2000-2018 the FFmpeg
# The encoder to use (if any -- see comment about "copy")
$ ffmpeg -encoders | grep omx
V..... h264_omx OpenMAX IL H.264 video encoder (codec h264)
# The decoder to use
$ ffmpeg -decoders | grep mmal
V..... h264_mmal h264 (mmal) (codec h264)
V..... mpeg2_mmal mpeg2 (mmal) (codec mpeg2video)
V..... mpeg4_mmal mpeg4 (mmal) (codec mpeg4)
V..... vc1_mmal vc1 (mmal) (codec vc1)http://www.heystephenwood.com/2018/08/s ... i-3-b.html