Time Delay with 4K Camera in Night Vision Mode (ZoneMinder 1.3X)

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
itoss
Posts: 33
Joined: Wed Oct 17, 2018 12:00 pm

Time Delay with 4K Camera in Night Vision Mode (ZoneMinder 1.3X)

Post by itoss »

Hello everyone,

I have been using ZoneMinder for several years, and for the past 2-3 years with a 4-camera. Initially, ZoneMinder ran on an HP MicroServer G8 with 16 GB RAM and a 1265L CPU. Over time, virtualization and VMs with VirtualBox were added. The entire setup worked great with 2K cameras and 2-3 Linux VMs. Web servers and other services ran natively on the G8 server.

Some time ago, I upgraded to an HP ProLiant ML110 G8 with 64 GB RAM and an E5-2695 v4 (18C/36T) CPU, along with an NVMe drive. The CPU has more cores but a slightly lower clock speed per core. On the ML110, I switched from VirtualBox (due to the discontinued web interface phpVirtualBox) to Proxmox, and I am very happy with Proxmox.

However, when running many VMs, I encounter the issue that the 4K camera is delayed by up to an hour before switching to night vision mode (grayscale view). After 1-2 hours in night vision mode, the time syncs again. I assume ZoneMinder compensates for the time delay due to the lower bitrate in night vision mode.

I have already installed an NVIDIA P2000 GPU for decoding the HEVC stream from the Reolink RLC 810 camera and passed it through to a VM where I installed ZoneMinder 1.37 for testing. According to nvtop and nvidia-smi, the stream is being decoded on the GPU, but the stream still lags by about 1-2 houers, too.

Additionally, I’ve noticed that when I set the source stream in ZoneMinder to 2560x1440 resolution and 32-bit color depth, the CPU load is lower compared to setting the stream to 24-bit at the same resolution. I don’t quite understand this, as the data stream should be smaller with 24-bit than with 32-bit. I’m now trying to reduce the resolution of the 4K camera while still using a 32-bit data stream. With the full 4K resolution of 3840x2160 at 24-bit, I experience a nearly 2-hour time delay before switching to night vision mode.

Is there any way to resolve this issue, other than reducing the stream bandwidth by adjusting the bitrate or resolution?

Thank you in advance for your help!
mikb
Posts: 701
Joined: Mon Mar 25, 2013 12:34 pm

Re: Time Delay with 4K Camera in Night Vision Mode (ZoneMinder 1.3X)

Post by mikb »

itoss wrote: Thu Mar 20, 2025 12:42 pm 32-bit color depth, the CPU load is lower compared to setting the stream to 24-bit at the same resolution. I don’t quite understand this, as the data stream should be smaller with 24-bit than with 32-bit.
This bit does make sense, from a programming point of view, to me. Not specific to ZM either!

If you handle the RGB data as four bytes, 32 bits, "R G B x" then you can move a pixel with a single instruction. Everything aligns nicely on round numbers of *4* ... which means calculating offsets is easier. Multiply by 4 is two-shifts-left. Fast.

If you insist on 24 bits, that's three bytes, "R G B". That suddenly starts to need more work to either pack-and-unpack from 32 bit values, or treat as 3 x 8 bit values. Calculating offsets is harder. x 3 is not a round number. It's "x 2 and add-the-number-you-started with".

Lots of code works faster when aligned nicely to the size/instructions of the processor. Even if that does mean wasting a byte for every pixel.
Post Reply