For the past year or so, I use BlueIris as my network video recorder (NVR) solution on a dedicated HP ProDesk computer, running Windows 10. BlueIris has proven to be a solid piece of software. Although I only use a fraction of its offerings, I still think it's worth the cost (yes, it's paid, proprietary and Windows only) and have no play to replace it.
That is, at least until yesterday, when the HP computer just died. Turns out, my cat sneaked into the basement and urinated on my server rack some weeks ago, and the liquid got into the case and slowly eroded the motherboard. The desktop was lying horizontally on the top shelf of my rack and caught most of the liquid, saving all the equipment beneath it. It's tragic but at the same time, pretty heroic.
I have a picture here to show the motherboard.
Well, it's time to pick a new NVR solution and chug along with life. I have previously tried Shinobi and concluded that the web interface was not to my liking. I tried ZoneMinder as well on an i5 computer back then, but it was simply not powerful enough to drive motion detection on 3+ cameras.
Understanding the pain points
After running security camera systems for more than a year, I have figured out my use case and exactly what I need from an NVR system. I simply need it to:
- Record 24/7 low-res footage on all cameras
- Low maintenance effort
- Low CPU usage and disk I/O (ideally)
What I thought I needed but actually don't:
- GPU encoding/decoding (pass-through is good for me)
- Motion detection (cats running around all the time, tons of false trigger)
- High-res footage (nice to have, but low-res is good enough)
- Multiple copies of backup (footage from weeks ago are not critically important)
With that in mind, I decide to try ZoneMinder again with a minimum viable configuration.
Deciding the hosting infrastructure
With the HP desktop down, I only have three servers left. Dell PowerEdge R720 as main hypervisor with 8 hard drives in ZFS mirror vdevs, HP ProLiant DL360p Gen8 as a experimenting server, and a dedicated backup server running TrueNAS. I better not mess around with the backup server, and I don't want to occupy experimenting server with mission critical tasks, the only logical choice is Dell R720.
ZoneMinder is a PHP web application running on top of LAMP stack, so it should have no problem running in a LXC container. In fact, this YouTube video shows exactly the same setup.
Follow the most recent guide on ZoneMinder wiki for either Ubuntu or Debian systems: add the source list, install dependencies and ZoneMinder itself. Fire up a web browser and go to x.x.x.x/zm, or have a proxy in front of it and go to my-zonminder-url.tld/zm and you are greeted with a setup wizard. At the time of writing, the most recent stable version is v1.36.12 on Debian 11 Bullseye.
Before running the wizard, I would add external storage to the LXC container. By default, ZoneMinder stores "events" under
/var/cache/zoneminder/events. This directory is owned by
www-data user and group. In Proxmox, there is a neat trick to bind mount a path on the host system to the guest container. In this case, I created a ZFS dataset
/tank/encrypted/zoneminder and bind mounted it to
/var/cache/zoneminder/events in the container. I had to add the following line in the container config file (
Reboot the container; the external storage will show up.
We also need to fix the permissions of the storage directory. By default, the
www-data user and group have UID and GID numbered at 33, which maps to 100033 on the host system. We could simply
chown -R 100033:100033 /tank/encrypted/zoneminder on the host system and call it a day. Since I already have a ZFS dataset with 100033 UID/GID bind mounted to the Nextcloud container, I would go the extra mile by changing the UID/GID number of
www-data user/group on ZoneMinder container to some number other than 33. The logic is that, if either container is compromised, their
www-data user/group can not touch the other's bind mount storage path on the host system. It may sound overly cautions, but reducing attack vector is always a good practice.
Adding Reolink Cameras
I have a total of five Reolink 5MP cameras. This wiki page and this Reddit post show how to add Reolink cameras to ZoneMinder. If in doubt, use ONVIF auto detection. I find it much easier probing than messing around with RTSP/RTMP feed URL.
Each camera has a sub stream and a main stream. I record sub streams 24/7 and use main streams as monitors.
For me, the sub feed URL is:
The main feed URL is:
Of course, substitute username and password based on your setup. The default username for Reolink cameras is "admin"; the default password is empty.
I won't go into details on how to configure ZoneMinder because I know everyone's need is different. However, I suggest at least add a filter rule to purge events when disk gets full.
Keep an eye on CPU and RAM usage, as ZoneMinder purely relies on CPU to do processing and it can get hungry in terms of resources. Also pay attention to tmpfs (
/dev/shm) if you do motion detection, as it can get filled up quickly. The size of tmpfs can be increased in VMs but not in LXC containers.
That's all I can think of right now. My configuration is very minimum. It works for me but may not suits everyone. I am still exploring ZoneMinder myself and may revisit this topic later on.