View Full Version : H264 encode changes hue and saturation
keeper182
22nd March 2022, 23:52
I'm afraid of making a dumb question since I'm not in the field of video encoding (I'm just an amateur), but I have researched everywhere and I don't find a solution.
I was trying to convert some of the videos I shot with the action cam that reaches up to 100Mbps, I don't mind loosing some quality in order to make space on my hard drive.
I have done my attempts with a free trial of a pro video converter and the free tool HandBrake, but I get the same results with both converters.
I have done several attempts but the image gets desaturated everytime and also the hue changes a little.
This is an example:
original
https://i.ibb.co/9cRQpJV/Original.jpg
encoded with HB
https://i.ibb.co/kQFHMZm/H264-Handbrake.jpg
The sets I have used: mp4-h264 (the original is also mp4), same fps as the original, same resolution as the original (4K), VBR 20 Mbps doble pass, no filters. Even using an higher bitrate or changing the encoder profile (I use Main) I keep getting this color issue.
With the pro video editor I could correct the image by appling filters to the saluration and the colors, but I guess this is not the proper way to proceed and I would prefer to do the task in a free way (the trial applies watermark).
Do you know what it could be or suggest me a specific guide I should read?
Thanks you
benwaggoner
23rd March 2022, 03:41
Desaturation and contrast changes aren't "compression" issues really. The actual codec compressor part maintains the overall luma and chroma levels quite well. Your sorts of changes generally happen upstream of the encoder or downstream of the decoder, in how the different kinds of color spaces convert back/forth.
The most common of those is that video normally has black at 16 and white at 235, while RGB has black at 0 and white at 255. There are all sorts of places in source filtering or playback conversions where that sort of problem can be introduced. We'd need to know more about your toolchain, and ideally get access to your encode, to offer more specific suggestions.
Selur
26th March 2022, 07:29
you might want to look into tv vs pc luma range of YUV content and how it should be signaled.
Sharc
26th March 2022, 13:59
In Avisynth try something like
SmoothTweak(brightness=-14,contrast=1.06,saturation=1.06,TVrange=True, Limiter=False)
Balling
27th March 2022, 11:39
>I have done several attempts but the image gets desaturated everytime and also the hue changes a little
Are you using normal player like mpv? Because that is like the only way to be sure.
Ritsuka
27th March 2022, 17:12
First make sure your player is playing back correctly, recently I found out that a lot of players (windows media player, vlc, etc…) on Windows did not display full range correctly when using an hardware decoder, it might be a issue specific to my gpu drivers, but who knows.
Second, there was a bug in HandBrake when encoding a 422 or 444 full range source, it did not convert to limited range properly. It will be fixed in the next HandBrake release.
Selur
27th March 2022, 17:56
it might be a issue specific to my gpu drivers, but who knows.
At least for NVIDIA cards you need to specifiy the output format in the driver configuration to RGB to get 0-255.
Balling
28th March 2022, 07:09
At least for NVIDIA cards you need to specifiy the output format in the driver configuration to RGB to get 0-255.
That has nothing to do with anything. Only mpv has a way to override the range of display anyway. But that is not what the problem was, the problem was about input.
benwaggoner
29th March 2022, 21:36
That has nothing to do with anything. Only mpv has a way to override the range of display anyway. But that is not what the problem was, the problem was about input.
Without input/output histograms to compare, we can't really know if it is a source or playback problem with the details provided.
keeper182
29th March 2022, 22:59
thanks to everyone, sorry I didn't see my post was approved
First make sure your player is playing back correctly, recently I found out that a lot of players (windows media player, vlc, etc…) on Windows did not display full range correctly when using an hardware decoder, it might be a issue specific to my gpu drivers, but who knows.
Are you using normal player like mpv? Because that is like the only way to be sure.
I am using PotPlayer and these are its settings:
color space output is on AUTO
https://i.ibb.co/RPhddSV/color1.jpg
while Matrix conv. YCbCR<>RGB is set to BT.601
https://i.ibb.co/P45v0L6/Senza-titolo-2.jpg
how can I know which one I have to set? (I use Intel drivers for integrated graphics)
Without input/output histograms to compare, we can't really know if it is a source or playback problem with the details provided.
which software would you recommend me for an histograms comparison?
keeper182
12th April 2022, 00:56
Second, there was a bug in HandBrake when encoding a 422 or 444 full range source, it did not convert to limited range properly. It will be fixed in the next HandBrake release.
Yes, I've found out that the converted video has limited color, while the original one is full. Apparently I am not the only one having this issue with Handbrake that only converts to limited.
Doing a research on the web I became aware that limited color is better for lcd screens and actually I prefer this kinda hdr look since the original one is too black in the dark areas, but I'm not very happy with the whites that actually look yellowish.
Thank you very much to everyone, I will wait for the next release of handbrake.
Sharc
12th April 2022, 07:30
while Matrix conv. YCbCR<>RGB is set to BT.601
https://i.ibb.co/P45v0L6/Senza-titolo-2.jpg
how can I know which one I have to set? (I use Intel drivers for integrated graphics)
For vertical resolutions >=720 (HD) the matrix is usually 709 by default, rather than 601 (SD). It matters for YUV<->RGB conversions.
You can inspect the file with MediaInfo (https://mediaarea.net/en/MediaInfo) and see what it reports.
Ritsuka
12th April 2022, 08:14
Yes, I've found out that the converted video has limited color, while the original one is full. Apparently I am not the only one having this issue with Handbrake that only converts to limited.
Doing a research on the web I became aware that limited color is better for lcd screens and actually I prefer this kinda hdr look since the original one is too black in the dark areas, but I'm not very happy with the whites that actually look yellowish.
Thank you very much to everyone, I will wait for the next release of handbrake.
Converting to limited color range does not affect the hue and saturation.
So either it's that HandBrake bug I was talking about, if so please try a HandBrake snapshot with the fix. Or your player is playing your file wrong.
Sharc
12th April 2022, 12:32
Maybe it's just a Potplayer issue. See the discussion here from 2017.
(I don't use Potplayer, so I don't really know).
https://forum.videohelp.com/threads/384014-Why-only-Potplayer-has-that-color-problem#post2489032
keeper182
13th April 2022, 02:45
Maybe it's just a Potplayer issue. See the discussion here from 2017.
(I don't use Potplayer, so I don't really know).
https://forum.videohelp.com/threads/384014-Why-only-Potplayer-has-that-color-problem#post2489032
Thank you, this solved the problem:
"In PotPlayer change the render to Built-in OpenGL Render."
Both videos were bad rendered, now both look the same: whites are whites and dark areas aren't that black.
Thank you all!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.