Raspberry Pi 4 8 GB
Posted: Sun Aug 16, 2020 4:17 am
I just set up a Raspberry Pi 4 8 GB for Zoneminder and it appears to be a viable three-camera server. I am currently in dev mode and it is writing video to the SD card, but I will move it to a USB 3 disk enclosure in the future. That may add some CPU IOWait time, but I doubt there will be significant performance issues.
Cameras
1 x Amcrest IP5M-1173E
2 streams at 640x480 and 2592x1944
1 x Amcrest IP8M-2493E
3 streams at 704x480, 1920x1080 and 3840x2160
Canakit Raspberry Pi 8 GB
CanaKit Premium White Case (High Gloss)
Set of 3 Aluminum Heat Sinks
CanaKit Fan
Samsung EVO+ 64GB Class 10 MicroSD Card
Ubuntu Mate 20.04 64-bit OS
Raspberry Pi OS Zoneminder was not able to recognize camera streams greater than 1080p
Zoneminder 1.34.19 installed from repository at ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu focal main
Modified the OS GPU configuration in /boot/firmware/usercfg.txt by adding:
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
gpu_mem=512
hdmi_enable_4kp60=1
Added an 8GB swap file to the file system
Added ONVIF cameras to Zoneminder
Amcrest IP5M-1173E
640x480 MOCORD 3 zones covering 70%; 20 frame buffers
2592x1944 NODECT linked to 640x480; 20 frame buffers
Amcrest IP8M-2493E
704x480 MOCORD, 2 zones covering 51%; 20 frame buffers
3840x2160 NODECT linked to 704x480; 20 frame buffers
System Performance
Zoneminder Processes
ps aux | grep zm
User PID %CPU %MEM VSZ RSS TTY STAT START TIME Command
www-data 8093 0.0 0.2 38920 17712 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
www-data 8121 4.8 0.8 222884 66440 ? SL 20:05 2:32 /usr/bin/zmc -m 1
www-data 8125 1.9 0.8 230264 69832 ? SL 20:05 1:02 /usr/bin/zma -m 1
www-data 8129 85.3 9.0 923792 727332 ? RL 20:05 44:42 /usr/bin/zmc -m 2
www-data 8137 4.4 0.7 219316 62608 ? SL 20:05 2:19 /usr/bin/zmc -m 3
www-data 8142 2.7 0.8 227436 67132 ? SL 20:05 1:25 /usr/bin/zma -m 3
www-data 8146 62.6 5.8 646588 466484 ? SL 20:05 32:47 /usr/bin/zmc -m 4
www-data 8155 0.0 0.4 54152 38488 ? S 20:05 0:01 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon
www-data 8156 6.5 5.7 626944 461204 ? SL 20:05 3:27 /usr/bin/zma -m 4
www-data 8162 0.0 0.4 54656 38860 ? S 20:05 0:01 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon
www-data 8169 0.0 0.2 38272 22664 ? S 20:05 0:01 /usr/bin/perl -wT /usr/bin/zmwatch.pl
www-data 8176 0.0 0.3 43240 27492 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmupdate.pl -c
www-data 8181 0.0 0.3 43396 27636 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmtelemetry.pl
www-data 8183 2.9 9.2 909904 739032 ? SL 20:05 1:33 /usr/bin/zma -m 2
www-data 8189 0.0 0.2 38024 22564 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmstats.pl
NOTE: -m 1 704x480p; -m 2 3840x2160p; -m 3 640x480p; -m 4 2592x1944p
Memory
free -m
total used free shared buff/cache available
7811 1762 3428 1171 2619 4772
no swap usage
/dev/shm 28%
CPUs
top
%Cpus 43.1us, 4.1sy, 0.0ni, 50.9id, 1.1wa, 0.0hi, 0.8si, 0.0st
NOTE: No motion detection processes were active; there are brief user spikes into the 60% - 70% range when a motion detection occurs.
NOTE: There is also a noticeable amount of time when user usage is in the 30% - 35% range.
Thermal
watch sensors
cpu_thermal-virtual-0
Adapter: Virual device
temp1: 63.3C
Observations
Raspberry Pi runs hot under moderate loads and a case, heat sinks and fan are required for Zoneminder.
The Raspberry Pi OS version of Zoneminder did not recognize either camera's streams at greater than 1080p, so it was not acceptable for my cameras.
The GPU modifications to /boot/firmware/usercfg.txt came from Google searches; the OS maintainers state the gpu_mem=512 statement is not necessary. I do not understand how the SOC manages CPU/GPU memory allocations and how the OS interacts so I added it assuming that video-intensive user processes may benefit. No benchmarks to back that up, though.
I added the 8 GB swap file after configuring Zoneminder and noticed a 10% - 15% decrease in CPU usage. No idea why because plenty of memory was free and the OS is not using swap. I only added a swap file because I'm old school.
Zoneminder logs buffer memory warnings at the default 20 frame buffers, but there is no noticeable issue with motion detection and recordings. Increasing the frame buffer to 40 did not stop the warnings and consumed a lot of /dev/shm memory, so I changed them back to 20.
The 8 GB Raspberry Pi 4 has sufficient memory for the cameras and can probably support another 5 MP camera.
The 8 GB Raspberry Pi 4 has sufficient CPU power for the cameras and can probably support another 5 MP camera.
Thermal issues under high load do not appear to be an issue when a case, heat sinks and fan are used,
Cameras
1 x Amcrest IP5M-1173E
2 streams at 640x480 and 2592x1944
1 x Amcrest IP8M-2493E
3 streams at 704x480, 1920x1080 and 3840x2160
Canakit Raspberry Pi 8 GB
CanaKit Premium White Case (High Gloss)
Set of 3 Aluminum Heat Sinks
CanaKit Fan
Samsung EVO+ 64GB Class 10 MicroSD Card
Ubuntu Mate 20.04 64-bit OS
Raspberry Pi OS Zoneminder was not able to recognize camera streams greater than 1080p
Zoneminder 1.34.19 installed from repository at ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu focal main
Modified the OS GPU configuration in /boot/firmware/usercfg.txt by adding:
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
gpu_mem=512
hdmi_enable_4kp60=1
Added an 8GB swap file to the file system
Added ONVIF cameras to Zoneminder
Amcrest IP5M-1173E
640x480 MOCORD 3 zones covering 70%; 20 frame buffers
2592x1944 NODECT linked to 640x480; 20 frame buffers
Amcrest IP8M-2493E
704x480 MOCORD, 2 zones covering 51%; 20 frame buffers
3840x2160 NODECT linked to 704x480; 20 frame buffers
System Performance
Zoneminder Processes
ps aux | grep zm
User PID %CPU %MEM VSZ RSS TTY STAT START TIME Command
www-data 8093 0.0 0.2 38920 17712 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
www-data 8121 4.8 0.8 222884 66440 ? SL 20:05 2:32 /usr/bin/zmc -m 1
www-data 8125 1.9 0.8 230264 69832 ? SL 20:05 1:02 /usr/bin/zma -m 1
www-data 8129 85.3 9.0 923792 727332 ? RL 20:05 44:42 /usr/bin/zmc -m 2
www-data 8137 4.4 0.7 219316 62608 ? SL 20:05 2:19 /usr/bin/zmc -m 3
www-data 8142 2.7 0.8 227436 67132 ? SL 20:05 1:25 /usr/bin/zma -m 3
www-data 8146 62.6 5.8 646588 466484 ? SL 20:05 32:47 /usr/bin/zmc -m 4
www-data 8155 0.0 0.4 54152 38488 ? S 20:05 0:01 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon
www-data 8156 6.5 5.7 626944 461204 ? SL 20:05 3:27 /usr/bin/zma -m 4
www-data 8162 0.0 0.4 54656 38860 ? S 20:05 0:01 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon
www-data 8169 0.0 0.2 38272 22664 ? S 20:05 0:01 /usr/bin/perl -wT /usr/bin/zmwatch.pl
www-data 8176 0.0 0.3 43240 27492 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmupdate.pl -c
www-data 8181 0.0 0.3 43396 27636 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmtelemetry.pl
www-data 8183 2.9 9.2 909904 739032 ? SL 20:05 1:33 /usr/bin/zma -m 2
www-data 8189 0.0 0.2 38024 22564 ? S 20:05 0:00 /usr/bin/perl -wT /usr/bin/zmstats.pl
NOTE: -m 1 704x480p; -m 2 3840x2160p; -m 3 640x480p; -m 4 2592x1944p
Memory
free -m
total used free shared buff/cache available
7811 1762 3428 1171 2619 4772
no swap usage
/dev/shm 28%
CPUs
top
%Cpus 43.1us, 4.1sy, 0.0ni, 50.9id, 1.1wa, 0.0hi, 0.8si, 0.0st
NOTE: No motion detection processes were active; there are brief user spikes into the 60% - 70% range when a motion detection occurs.
NOTE: There is also a noticeable amount of time when user usage is in the 30% - 35% range.
Thermal
watch sensors
cpu_thermal-virtual-0
Adapter: Virual device
temp1: 63.3C
Observations
Raspberry Pi runs hot under moderate loads and a case, heat sinks and fan are required for Zoneminder.
The Raspberry Pi OS version of Zoneminder did not recognize either camera's streams at greater than 1080p, so it was not acceptable for my cameras.
The GPU modifications to /boot/firmware/usercfg.txt came from Google searches; the OS maintainers state the gpu_mem=512 statement is not necessary. I do not understand how the SOC manages CPU/GPU memory allocations and how the OS interacts so I added it assuming that video-intensive user processes may benefit. No benchmarks to back that up, though.
I added the 8 GB swap file after configuring Zoneminder and noticed a 10% - 15% decrease in CPU usage. No idea why because plenty of memory was free and the OS is not using swap. I only added a swap file because I'm old school.
Zoneminder logs buffer memory warnings at the default 20 frame buffers, but there is no noticeable issue with motion detection and recordings. Increasing the frame buffer to 40 did not stop the warnings and consumed a lot of /dev/shm memory, so I changed them back to 20.
The 8 GB Raspberry Pi 4 has sufficient memory for the cameras and can probably support another 5 MP camera.
The 8 GB Raspberry Pi 4 has sufficient CPU power for the cameras and can probably support another 5 MP camera.
Thermal issues under high load do not appear to be an issue when a case, heat sinks and fan are used,