Raspberry π4 for ZoneMinder
- Part 1 – Raspberry π4 8GB for Zoneminder
- Part 2 – Update: Raspberry π4 8GB for Zoneminder
- Part 3 – Another update: Raspberry π4 for Zoneminder (you are here)
My π4 Zoneminder has been running for just over two months. Overall I’m pretty happy with it. The main issue I had was that the current stable version of Zoneminder 1.34.x was not available for the ARM64 version of Pi OS in the Debian repository. At time of writing, most of the current release of Pi OS is in fact Debian version 10 (Buster), and it comes from the Debian repositories.
Only the slightly older 1.32.x series of Zoneminder is available for ARM64 Pi OS in the standard Debian repositories. To get round this problem, I tried installing Ubuntu 20.04.1 LTS for ARM64 instead. However, I found Ubuntu runs slower than Pi OS on ARM64. So I went ahead with Pi OS for ARM 64 anyway and installed the slightly older version of Zoneminder.
Zoneminder 1.32.x works reasonably well – it’s certainly is good enough. Unfortunately 1.32.x also has some irritating bugs that were fixed in 1.34.x. Fortunately, that is history now
Finding Zoneminder 1.34 for ARM64
Or how I fixed the biggest annoyment of all 🙂
I after a lot of hunting, I finally stumbled-upon a version of Zoneminder v1.34 compiled for ARM64 over at the unofficial Debian Multimedia repo, which seems to work an absolute treat. Here’s how you get it.
Firstly, open a terminal and open the sources.list file for editing, as root…
sudo nano /etc/apt/sources.list
Edit the file so it reads file like this. Note, a little common sense may be required here, if you have other repos enabled or other comments…
deb http://deb.debian.org/debian buster main contrib non-free deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free deb http://deb.debian.org/debian buster-updates main contrib non-free # Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source' #deb-src http://deb.debian.org/debian buster main contrib non-free #deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free #deb-src http://deb.debian.org/debian buster-updates main contrib non-free # Added by garf 2020-12-11. # This is the bit that gets the latest ZM. deb http://www.deb-multimedia.org buster main non-free deb http://www.deb-multimedia.org buster-backports main
Assuming you already have installed Zoneminder 1.32 all you do now is run the following command in a terminal window…
sudo apt update && sudo apt dist-upgrade
Seeing what’s going on, at a glance
You may wish to check your Pi’s temperature, look at how heavily you are loading your CPU’s. So you might find this little script quite handy…
The shell script code for the above is as follows. Copy it from here and paste it into nano, or some other text editor of your choice:-
#!/bin/bash # Script: garf-pi4-stats # Purpose: # Display the ARM CPU and GPU temperature of Raspberry Pi 4 # as well as # users, CPU load averages and hard disk usage. # Probably works on other Pi's too. # This is very useful for headless installations, # to get a view of what's going on when you connect via SSH. # Orginal author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+ # Tweaked by Garf 2020-11-30 for Pi 4 with some extra # features added that others may or may not find useful. # This script comes with no warranties express or implied. # ------------------------------------------------------- cpu=$(</sys/class/thermal/thermal_zone0/temp) echo "" echo "-------------------------------------------" echo "I am \"garf-pi4-stats\" shellscript..." echo "A simple Garf Technology π4 info doodat" echo "Initiated: $(date +"%F %R" ) @ $(hostname)" echo "-------------------------------------------" echo "" echo "GPU: $(vcgencmd measure_temp)" echo "CPU: temp=$((cpu/1000))'C" echo "" echo "SSD usage:" df -h echo "" echo "Uptime:" uptime echo "" cowthink "$(fortune) OK, moove along please..." echo "" # EOF
Assuming you are using nano…
Paste the the code you copied a little earlier (shift+ctrl+v). Save the file (ctrl+x) then chmod the file to make it executable
chmod +x ~/bin/garf-pi4-stats
Note: you need to have cowsay and fortune installed if you want the silly bit at the end
sudo apt install cowsay fortune
Another little problem
I had to reboot my modem rack a few weeks back because our internet connection stopped working. It turned out to be an issue at our ISP’s end. When I powered it all up again, I discovered that the π4 boots significantly faster than our router, therefore it doesn’t get an IP address from the router (!!!).
Fortunately, it is relatively easy to make π4 fall back to a static IP if DHCP fails. It’s explained in the comments at the bottom of /etc/dhcpcd.conf – and works perfectly.
sudo nano /etc/dhcpcd.conf
I run the π4, an Avignon A2D x264 converter/encoder (for legacy analog cams), an 8 port Ethernet switch, a TP Link Router, a Draytek broadband/cable modem, four cameras and our door entry system all from the same 12 volt switch-mode steel-cased PSU and fused distribution board, as pictured above. This PSU in turn, gets its mains power from our UPS (uninterruptible power supply).
This particular model has LED indicators to indicate whether the fuses are intact or not. These DC distribution boards are specifically designed for CCTV systems and eliminate the need for loads of wallwarts and extension leads. It’s safer and significantly more energy efficient too. I then use a simple 12v to 5v buck converter to drop the 12 volt PSU output to 5 volts to power the π4.
I am measuring the π4’s power consumption quite carefully ATM. You can just see the little USB DMM bottom-far-left of the above image. It averages between 5 and 7 watts – and that includes the 1TB NVMe SSD. The original Zoneminder PC consumed between 40 and 55 watts.
I am successfully running 8 cameras of the following types…
- 2 off 720px x 576px (both recording h.264 pass-through via Avigilon A2D converter – fixed position)
- 2 off dummy 720p x 576px (both “monitor only” via Avigilon A2D converter – fixed position)
- 3 off 1920px x 1080px (all recording h.264 pass-through, IP-type, PTZ)
- 1 off elderly 640px x 480px (“monitor only”, IP-type, PTZ)
Load averages to creep up from around 2 to between 4 and 5 once several people start looking at cameras, but that is to be expected. I am also considering various optimisations, such as increasing the size of /dev/shm so that ZM can make use of more of π4’s 8GB RAM.
The thing I least like about my ZM system is having the NVMe disk in a separate case. Granted its not really a major issue because I hardly ever see the set up anyway. My wife can’t understand why it bothers me at all. I only ever see it when I go into the garage. In fact, I really have to peer into the modem rack just to catch a glimpse of either the π4 or the SSK NVMe case at all – as previous photos will bear testament. Nevertheless, it still niggles me!
Meantime I have been testing and tweaking my Zoneminder set up to see what happens under various load conditions. Overnight I set all 8 camera streams to maximum resolution and 25 fps. This bumped the load average up to above 7 . This is far too high for a quad-core running a streaming application. However the device temperature and indeed the SSD seem relatively unaffected. The FLIRC π4 case reached 38°C and the SSK NVMe case reached 32°C. Both are cases designed to act as heatsinks. Of course I am cheating here. I’m guessing that placing both devices on a 200mm x 200mm x 1.2mm slab of perforated stainless steel probably has a more than minor effect on dissipating heat!
I set the frame rates for all the cams back to 10fps – not exactly broadcast quality but perfectly adequate for CCTV. The system π4 replaces could barely make 2fps at 640px x 480px! I left the resolution on max: three cams at 1920px x 1080px, four at 720px x 576px and a very old one at 640px x 480px. Uptime is now reporting load averages at a very acceptable: 2.69, 2.34, 2.66 – though obviously these goes up a bit when I start actually viewing video streams. Device case temperatures are now 36°C and 31°C for the π4 and the NVMe respectively.
Just rebooted after 45 days uptime, due to a kernel update. System is retaining just over a month’s video from 6 cameras (3 of which are 1080p) – though, as i said earlier, I have restricted the frame rate to 10 fps. CPU load average generally hovers between 3 & 4 (which is fine for a 4-core CPU). And all the while, it’s consuming around 6 watts of power!