API Snapshot quality is MUCH worse than Web Snapshots - blocky artifacts in shadows plus overall lightening

I setup my 2nd camera on a scene that has a wider dynamic range with varying colors with more controlled light ... and yea, for this scene, I can see more of a difference in quality between VBR and CBR ... albeit I "pay" for it with a much larger file size.

Better yet, it provides a good example of the "lightening of the image" - below are the actual images as pulled from via the web interface and the API. The noise/quality is comparable ... but the API generated JPEG is "lightened" in the shadows (with the highlights knocked down) which is most easily seen in the GIF generated from Photoshop showing the difference.


Web-v-API-inside.gif


20240105_062704.png


API.jpeg
 
Last edited:
You will notice a difference between VBR/CBR and bitrate when there is movement.
On still image the difference will be less to zero visible.

Not sure what your aim of these pictures is, but in my opinion its ridiculous complaining about that.
In reality the colors on both pictures look awful for me. Color corrections etc can be done easily with any photo software if need one of these pictures for something important.
 
I agree the color balance is bad in the "house" pictures. What I'm highlighting is the difference between the PNG from the web interface and the JPEG from the API.
Here's the histograms of those two pictures from Photoshop - note the compression of the dynamic range by boosting the shadows and knocking down the highlights.

Histogram-WebPNG-vs-APIJPEG.gif



Histogram-WebPNG-vs-APIJPEG.jpg
 
So as demonstrated above in the histograms, the JPEG generated from the API has a compressed dynamic range by boosting the shadows and knocking down the highlights. I also pointed out earlier that Hikvision has a Grey Scale option (Image->Image Enhancement) where you can choose the grey scale range as [0-255] or [16-235] ... I'm now pretty certain is the Dahua is doing [16-235] when it generates JPEG's via the API.

I don't know why I didn't think of this earlier, but it was trivial to open the PNG in Photoshop (which has RGB values from 0-255) and simply change the Output Levels to 16-235 ... and BOOM ... that JPEG looks a LOT like the one generated from the API - see GIF below.

Obviously this "flattening" of the image (and loss of contrast) doesn't look as good ... and I can't imagine any reason to not use all of the RGB values from 0-255.

I suspect the internal algorithms are doing something goofy in the Color Space - maybe using YCbCr?
Regardless, is there any way to change that? I didn't see any color space options nor a "grey scale" (as with the Hikvision) to change via the web interface or in the Encode.Snapformat settings.


Web-v-Web16-235-v-API-inside.gif
 
Last edited:
Since I just posted this image in another thread, I'll put it here as an example - please see that post for details.

Clearly shows the compressed dynamic range when you pull snapshots (versus the video stream). Note this is NOT an image quality/sharpness issue - I would expect those to be different depending on the bit rate of the video stream versus the compression of the snapshot.

It also shows that there is probably (?) a duplicate but different code path for text overlays since the timestamp is formatted differently and "IPC" shows up on the snapshot, but not on the video because the GUI has is disabled ... which it should do for both.


2024_07_18_Raccoons-ffmpeg-stream_vs_event-snapshot.gif
 
  • Like
Reactions: Mark_M