How to bypass video compression in Dahua camera

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
798
Location
Poland
Currently I’m testing Dahua IPC-HFW7842H-Z. Hopefully the review will be ready soon, but there is still plenty to do, and I have to find time to put all material together. Anyway, while testing the camera, I’ve found something I was thinking about since my first Dahua I bought. That is, how to get the best quality image from the camera, omitting all video compression. I was wondering if this is possible at all.

It turns out, it is. Unfortunately it only works with snapshots, not video files. Normally, when you use motion detection, the camera records a video, compressed with h264/h265 codec. If you turn on snapshot recording, the still images will be also compressed with this compression and then saved as JPG files. In other words, it will be only a frame grabbed from already compressed video file. Same goes for snapshot function while watching live footage through Web Interface. If you click snapshot button, you’ll get a large – apparently uncompressed - bitmap file, but all the compression will be already there.

What I’ve noticed though, is that when using IVS smart functions, the camera is pushing data straight from the sensor, omitting all video compression. The only compression applied is JPG and it is controlled by snapshot quality setting in VIDEO settings. Snapshots taken by IVS functions are completely independent of video compression you set. You can have the bitrate set to 1000kbps and while the video will look awfully, the snapshot will be good. Look at the example below:

compression.jpg

On the left side is a frame grabbed from video file. The bitrate was set to 7000kbps. For a 4K camera it is not much. On the right side you see a snapshot taken with a use of Video Structuralization function. The difference is obvious. I’ve checked this on my other cameras, and it worked everywhere. The Tripwire function will do the trick.
 

gijsv

n3wb
Joined
Nov 11, 2018
Messages
7
Reaction score
1
Location
holland
This is really great!
I'm trying to get a snapshot onIVS triggers, but i can't get it to work...
What settings to use? Can you help me out?
 

RubberDucky

Young grasshopper
Joined
Jan 8, 2020
Messages
30
Reaction score
9
Location
Canada
Since I normally use IVS motion detection I was intrigued by your findings. So I tried this on my 1831E (setup an FTP server and saved to there since it has no SD card).

Drastically reducing my video bitrate to 128kbps produced a bad video picture like the one on your left while the IVS snapshot was good without apparent motion artifacts. So that confirms your findings that the IVS snapshot is independent of the video stream bitrate (Intrusion detection).

However at my normal 8192 kbps (much like your 7000kbps) I see no practical difference. Both look good similar to your "uncompressed" picture on the right. So no real benefit in my case.
 
Last edited:

wopi82

IPCT Contributor
Joined
Feb 9, 2017
Messages
117
Reaction score
798
Location
Poland
@gijsv
There is plenty of tutorials on the Internet. For example, this one:
In some cases the new firmware may lock all IVS functions. I’ve updated the firmware in my HDW5442EM-AS LED and since then, all IVS functions are completely dead.

@RubberDucky
I had exactly same observations. The example above is from 7842, where the car was moving pretty fast and the image is a 100% crop from wider view. That’s why, there is so much compression visible. When comparing similar examples from 1831 or 5442, there was little difference. I think, the main point here, is that you don’t have to crank up your video bitrate to get good quality IVS snapshots. You may want to use IVS images for reviewing object details (cars, people, ect) while at the same time, record low quality video to see what was the action going on. You’ll have both, and still keep lot of storage space.
 
Last edited:

arium76

n3wb
Joined
Feb 3, 2019
Messages
20
Reaction score
10
Location
Australia
I have similar issue with Night video quality, I've just purchased 2 x
IPC-HFW3849T1-AS-PV
and video quality at night is really bad once IVS is enabled and trip wires are added. However when I delete tripwire IVS is disabled and video quality comes back.
 

CCTVCam

Known around here
Joined
Sep 25, 2017
Messages
2,660
Reaction score
3,480
I think there's a very good reason why you can't turn video compression off.

Pull a 10 second video file into a video editor then output it as uncompressed. You'll soon see for yourself. Even a couple of secs of video takes up GB's of space! I doubt there is a consumer available hard drive on the planet large enough to contain even a couple of hours of video, and all that assumes your pc doesn't crash under the strain.

The only real use I could see for uncompressed would be to output from the camera uncomressed and then encode it on an enocder or dedicated encoding pc. However, I'm guessing network capacity would be a further issue.

For snapshots it's different. Enncoding a single frame uncompressed is a whole different ball game. Don't forget video is 10-30 x frames per second (!) depending on your frame rate setting.

Not sure why adding a tripwire should degrade video compression unless your pc was CPU bound.
 

arium76

n3wb
Joined
Feb 3, 2019
Messages
20
Reaction score
10
Location
Australia
I think it could be a firmware bug as its going directly to Dahua NVR , both cameras and NVR have latest firmware. DHI-NVR4108-8P-4KS2
System VersionV4.001.0000005.1, Build Date: 2021-07-13
 
Top