Zoneminder 1.37 no image – capturing but not analyzing
Zoneminder version 1.37.28. The installation had been running for years without problem but somehwere in the 1.37 version problems started to occur. Some cameras did not give visible streams in Zoneminder from time to time. Checking the cameras video directly, they where ok, so the problem was in Zoneminder. Some cameras was “capturing” but analyzing 0 fps.
In the log there was lines like:
Restarting capture daemon for 6 CAMERA NAME, no image since startup. Startup time was 1671521356 – now 1671521366 > 5
And mostly interesting:
You have set the max video packets in the queue to 100. The queue is full. Either Analysis is not keeping up or your camera’s keyframe interval 50 is larger than this setting.
The reason for this is that the buffer setting for Maximum Image Buffer size (frames) is too low compared to the key frame interval setting in the camera. The higher key frame interval (which means lower bandwidth) means Image Buffer Size must be higher, consuming more RAM. So what you save in bandwidth, you will pay in RAM. Key frame interval is how often the camera sends a full image and between them just the difference. More seldom (higher key frame interval) means lower bandwidth but you need a bigger buffer in the server.
I set my cameras to deliver 5 fps with a key frame interval of 5 as they are on a remote location (not where the server is) and all video is streamed over the Internet to the server.
I changed the options for each camera, Console -> click on source -> Buffers and change Image Buffer Size (frames) (in my case set it to 3) and Maximum Image Buffer Size (frames) (in my case I could actually decrease it from 100 to just 55 because I reduced the fps and decreased the key frame interval in the camera).
Observe how memory is used after this. You need to balance the buffer sizes the cameras fps and key frame interval
Still it did not completely solve the problem. Only after changing Options -> System -> WATCH_MAX_DELAY from 5 to 45 and restart Zoneminder, the system started to show images for all feeds. It seems like 5 seconds for the capture to start was to little so it keept restarting the capture processes.
/tmp
As a part of the investigation I had also changed /tmp into tmpfs according to some post I found online, so I did that also but it did not solve the problem. However, it improved performance so I let it be. Add the following line to /etc/fstab and reboot:
tmpfs /tmp tmpfs rw,nosuid,nodev
Disable unused cameras
Another important thing when it comes to Zoneminder performance is to disable unused cameras. You can leave the camera in the Zoneminder configuration for later use but if it is going to be offline for a longer period, it is a good idea to disable it because a camera that is offline will put unecessary load on the Zoneminder server.
Go to Console -> click on source -> Source and set Capturing to None
Remember to put it back when the camera is online again 😉