Video records FPS much lower than original stream

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
deuterium
Posts: 4
Joined: Tue Mar 09, 2021 11:18 am

Video records FPS much lower than original stream

Post by deuterium »

I'm using 1.34.26 Zoneminder on Ubuntu 20.04 with single IP-camera. Camera resolution is set to 1280x720, and it is plugged over 100Mb Ethernet cable, so bandwidth is enough - when playing rtsp stream with VLC, I get more than 20 fps.
When watching image on ZoneMinder console, it indicates about 25 fps, but in fact, image freezes each second or two for half-second. I have increased "Stream Replay Image Buffer" parameter from default 1 to 1000, as recommended in some topics of the forum, freezing's becomes rarely, but do not disappear.
When recording alarm event, fps is even lower - less than 3 fps, and frames are very uneven, in FRAMES list there can be only one frame in some second. Processor speed is not the reason - I have recently changed hardware from AMD Athlon(tm) XP 2400 to Celeron J4125, it is at least 10 times faster, but fps does not increased. CPU load is about 20% on two cores and less than 5% on the other two.
Than I assumed, the problem may be in camera's codec (H264), neither VLC not SMPlayer shows any errors in logs, but sometimes there are image artefacts. So I plugged into the server 640x480 usb camera and create ZoneMinder monitor using v4l2 driver. It behaves in the same way - freezings when displaying webcam in browser, 20+ fps indication but not more than 4 fps in recorded alarms.

Does anybody have any ideas, how to increase fps in event recordings or at least - what is the reason for it?
deuterium
Posts: 4
Joined: Tue Mar 09, 2021 11:18 am

Re: Video records FPS much lower than original stream

Post by deuterium »

I've made some investigations myself. ZM log permanently includes messages:
<camera name> - Analysing at XX fps
<camera name> - Capturing at YY fps, capturing bandwidth ... bytes/sec
And sometimes - warnings:
Approaching buffer overrun, consider slowing capture, simplifying analysis or increasing ring buffer size
Buffer overrun at index 198, image 2744798, slow down capture, speed up analysis or increase ring buffer size
First of all - XX and YY may differs and none of them have have anything in common with real capturing fps. I decided to vary "Image Buffer Size (frames)" value. Each time I change camera settings, log becomes full of errors like "Socket /run/zm/zms-329535s.sock does not exist", "'zma -m 1' exited abnormally," and image disappears for several minutes, so you need just to wait. First time I didn't know about this, and try to restart ZM, than change buffer size back. However, after capturing and analysis are back, framerate visually increases, and "Buffer overrun" messages almost disappears, but frames are still very uneven. I made several more changes of this parameter, increasing it slightly improves average fps, but records still freezes for half-second or so. Also, actual fps (counted as frames/seconds) is much lower than the one, indicated in log messages, no matter what is the size of buffer. And "Buffer overrun" warnings still appears periodically, even with buffer size is set to 1000.

I want to know, is it a problem of my particular system or ZM in common, so my questions to everybody are:
- What fps ZM indicates in "Analyzing.. " and "Capturing.. " messages on your system and does it match actual fps in alarm recordings?
- Do you have "buffer overrun" warnings in log?
- Does camera image freezes periodically (both in live preview and in recordings)?
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Video records FPS much lower than original stream

Post by dougmccrary »

On the unwanted logs:
you can adjust those with settings in Options -> Logging -> LOG_LEVEL_*

Don't forget to hit the 'save' button at the bottom of the page.
deuterium
Posts: 4
Joined: Tue Mar 09, 2021 11:18 am

Re: Video records FPS much lower than original stream

Post by deuterium »

My problem is not in logs, but in low fps rate, logs is just the tool I use to investigate the problem.
By the way, I'm surprised that this problem is considered insignificant, low fps can make impossible any intellectual motion detection algorithms..
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Video records FPS much lower than original stream

Post by dougmccrary »

My problem is not in logs, but in low fps rate, logs is just the tool I use to investigate the problem.
You indicated it was constant. It is normal. I suggested you could eliminate those info log entries.

So, are you trying to make a TV movie with this? Not gonna happen.

Just for kicks, please try setting the camera fps to something like 5, and see if that makes any difference, in terms of lost frames and buffer overruns. I think you'll find it does. You can increase it from there if it helps.

BTW, I'm not sure what, if anything, "Stream Replay Image Buffer" has to do with watching the live stream. I've never changed it from 0.

Good luck.
Post Reply