Shinobi CCTV for aarch64 with hardware acceleration support for RPi and Rockchip boards
10K+
Shinobi is open source CCTV solution. This image supports hardware acceleration for Raspberry Pi (MMAL and V4L2 M2M) as well as Rockchip (MPP) based boards (e.g. Rock64).
This Dockerfile is used to build images.
It is based on this fork of official Shinobi.
docker run -d \
--name="shinobi" \
--privileged \
-p "8080:8080/tcp" \
-v "/dev/shm/Shinobi/streams":"/dev/shm/streams":"rw" \
-v "/dev":"/dev":"rw" \
-v "/var/cache/shinobi/config":"/config":"rw" \
-v "/var/cache/shinobi/customAutoLoad":"/home/Shinobi/libs/customAutoLoad":"rw" \
-v "/var/cache/shinobi/database":"/var/lib/mysql":"rw" \
-v "/var/cache/shinobi/videos":"/home/Shinobi/videos":"rw" \
-v "/var/cache/shinobi/plugins":"/home/Shinobi/plugins":"rw" \
-v "/etc/localtime":"/etc/localtime":"ro" \
gagara/shinobi-arm64:latest
or simply use this docker-compose file like
docker-compose -f docker-compose-aarch64.yaml up
It is good idea to mount some external SSD/HDD to /var/cache/shinobi before running it (it stores videos, images, DB files there)
To build image yourself, checkout repository and switch to aarch64 branch
git clone https://gitlab.com/gagara/Shinobi.git
cd Shinobi/
git checkout aarch64
then build image
docker build -t gagara/shinobi-arm64 -f Dockerfile.aarch64 .
Note: Latest images are based on Gentoo, thus building everything from scratch may take quite some time and resources. To optimize this process it is possible to pass space-separated list of Gentoo's binhosts as docker build argument. e.g.:
docker build -t gagara/shinobi-arm64 --build-arg BINHOST="https://packages.server.com" -f Dockerfile.aarch64 .
By default https://packages.genpi64.com/ is used as binhost.
With RPi boards there are two options:
Supports h264, mpeg2, mpeg4, vc1 decoders.
Note: MMAL is not officially supported on aarch64 so far. If you have any troubles with it consider switching to v4l2m2m which is supported and has even better performance.
/dev/dri (e.g. /dev/dri/card0). If you don't have such devices available then read the docs of your distro on how to enable it. Usually you need to have dtoverlay=vc4-fkms-v3d enabled in your config.txt and enough "video RAM" -- gpu_mem=128 at least.YesDRMH.264 (Raspberry Pi )/dev/dri/card0Supports h263, h264, h265, mpeg1, mpeg2, mpeg4, vc1, vp8, vp9 decoders and h263, h264, h265, mpeg4, vp8 encoders. Officially supported on aarch64!
/dev/video10, /dev/video11 available on your system. If you don't have them, then read the docs for your distro on how to enable it.YesAutoV4L2 mem2mem H.264 (Raspberry Pi)Note: Hardware acceleration on RPi has series of limitations/drawbacks:
gpu_mem setting is 512, you won't be able to handle more that 4 streams in parallel.Fortunately Shinobi has great support of sub-streams handling. So if your camera has substreams (usually low resolution) you can use it with Shinobi and it will dramatically improve performance without any quality/experience loses. Read next section about this.
In most cases for motion detection you don't need full resolution, fps, etc from your camera. By default Shinobi uses 640x480, 2 fps, grayscale picture which is perfectly enough. If you grab 1080p, 25fps from your camera then a lot of CPU/GPU time is required to transcode it to lower quality for Motion Detection engine. Most modern cameras support several streams. Main stream -- full resolution, max quality, and sub-streams -- low resolution. You can configure Shinobi to use e.g. main stream for recording and substream for motion detection and streaming (live view). See this doc for details about additional streams aka Input Feeds in shinobi. For example you can configure it like this:
01.001It is reasonable to configure sub-stream resolution in your camera to match with resolution you use in Global detector settings.
This kind of setup on my RPi4 with 6 cameras (3MP, h264) keeps CPU load under 20%.
Rockchip has very powerful support of video hardware decoding (MPP).
Supports h264, h265, vp8, vp9 decoders.
/dev/dri (e.g. /dev/dri/card0). If you don't have such devices available then read the docs of your distro on how to enable it.YesDRMH.264 (RockChip)/dev/dri/card0On my test system (Rock64 board) with 6 3MP (h264) cameras (in full resolution!!!) keeps CPU load under 40%. Which is way better than on RPi.
You can benefit even more if you use Sub-streams in Shinobi described above.
Content type
Image
Digest
Size
1.4 GB
Last updated
over 4 years ago
docker pull gagara/shinobi-arm64