Camera Passthrough gives bad video

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
ibrewster
Posts: 31
Joined: Sat Aug 31, 2019 4:18 pm

Camera Passthrough gives bad video

Post by ibrewster »

I'm new to zoneminder and working on getting my cameras all set up. At the moment, I have two cameras: an old 640x480 one, and a new 1920x1080 one. This question is about the later.

Summary: When using the X264 Encode video writer, everything works well, but (as expected from the documentation) I get no audio. When switching to H264 Camera Passthrough video writer, I get audio, but video quality suffers dramatically. What might be the cause?

Details:

Network is all hard-wire Gigabit Ethernet (though the camera itself if probably only 100Mb)
Camera is ONVIF
Source Type Ffmpeg
ZoneMinder 1.32.3
HOSafe H2MD6PA Camera

I first set up everything using the X264 Encode video writer, and spent a couple days tweaking zones. With these settings, everything works well (well, other than false alarms at night, but that's a different question), and I get good video recorded during alarms. As expected, there is no audio, so I wanted to switch to H264 Camera Pass through. When viewing the camera directly from it's webpage, it works well. However, when viewed through ZoneMinder (and recorded during an alarm), I ran into the following issues:

- Low frame rate (relatively speaking). With the X264 encode option, I get a pretty solid 20 FPS. When switching to passthrough, this drops to about 15 FPS, and closer to 9 when something is actually happening. This in itself is not a problem (9 FPS is fine in general), but it is a significant drop from using the X264 Encode setting

- Video artifacts. this *is* a problem. Whenever something moves across the frame, it freezes and smears. So, for example, I'll have a smeared image of a car driving past for several seconds after the car has passed

- Video quality. During normal times, it's fine. When something happens in the scene, I start getting what look like compression artifacts, getting worse as the motion gets larger (a bird flying past may not get much degradation, a car driving past can practically blur the scene into unreconizability). When watching the live stream, after a minute or two it often starts looking like a pointalisim painting.

But hey, I get audio on the recording! So that's good... Video is unusable, but I get audio. None of these issues are apparently when watching the camera directly.

So what might be causing these issues, and is there anything I can do to fix them? Video bitrate setting on the camera too high/low? Not enough horsepower on the Zoneminder machine? Some other setting I can tweak? Thanks.

A *mild* example. Notice the artifacts around the car.
3_5704_519.jpg
3_5704_519.jpg (389.54 KiB) Viewed 2296 times
Using X264 Encoding, note that the car is pretty much clear.
3_5707_89.jpg
3_5707_89.jpg (289.41 KiB) Viewed 2296 times
Attachments
Screen Shot 2019-08-31 at 10.32.43 AM.png
Screen Shot 2019-08-31 at 10.32.43 AM.png (183.93 KiB) Viewed 2296 times
User avatar
iconnor
Posts: 2900
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Camera Passthrough gives bad video

Post by iconnor »

first step, clear your max fps fields they will just starve ffmpeg for cpu.

second if that doesn't help is upgrade to latest master and see if i havn't already fixed the problem.
ibrewster
Posts: 31
Joined: Sat Aug 31, 2019 4:18 pm

Re: Camera Passthrough gives bad video

Post by ibrewster »

iconnor wrote: Sun Sep 01, 2019 3:12 pm first step, clear your max fps fields they will just starve ffmpeg for cpu.
That worked, thanks. Just out of curiosity: why did that work? I would have thought those settings would just be limits such that if the frame rate tried to go higher, it would start dropping frames - I wouldn't have thought they'd have any effect if the frame rate was lower than the limits. Yet, clearing those did seem to solve the problem. Interesting. Thanks again!
User avatar
iconnor
Posts: 2900
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Camera Passthrough gives bad video

Post by iconnor »

The code tries to calculate how much time it should sleep to achieve the framerate. But it doesn't know how long ffmpeg will take to do the decoding. You would think that a sufficiently high fps would result in no sleeping but it does. I could probably improve the sleep code, but it is more correct to just not do it.
Post Reply