Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd March 2022, 23:52   #1  |  Link
keeper182
Registered User
 
Join Date: Feb 2022
Posts: 12
H264 encode changes hue and saturation

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


encoded with HB


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
keeper182 is offline   Reply With Quote
Old 23rd March 2022, 03:41   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th March 2022, 07:29   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
you might want to look into tv vs pc luma range of YUV content and how it should be signaled.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 26th March 2022, 13:59   #4  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
In Avisynth try something like
Code:
SmoothTweak(brightness=-14,contrast=1.06,saturation=1.06,TVrange=True, Limiter=False)
Sharc is offline   Reply With Quote
Old 27th March 2022, 11:39   #5  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 541
>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.
Balling is offline   Reply With Quote
Old 27th March 2022, 17:12   #6  |  Link
Ritsuka
Registered User
 
Join Date: Mar 2007
Posts: 95
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.
Ritsuka is offline   Reply With Quote
Old 27th March 2022, 17:56   #7  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Quote:
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.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 28th March 2022, 07:09   #8  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 541
Quote:
Originally Posted by Selur View Post
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.

Last edited by Balling; 29th March 2022 at 14:52.
Balling is offline   Reply With Quote
Old 29th March 2022, 21:36   #9  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
Quote:
Originally Posted by Balling View Post
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.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 29th March 2022, 22:59   #10  |  Link
keeper182
Registered User
 
Join Date: Feb 2022
Posts: 12
thanks to everyone, sorry I didn't see my post was approved

Quote:
Originally Posted by Ritsuka View Post
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.
Quote:
Originally Posted by Balling View Post
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


while Matrix conv. YCbCR<>RGB is set to BT.601


how can I know which one I have to set? (I use Intel drivers for integrated graphics)

Quote:
Originally Posted by benwaggoner View Post
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 is offline   Reply With Quote
Old 12th April 2022, 00:56   #11  |  Link
keeper182
Registered User
 
Join Date: Feb 2022
Posts: 12
Quote:
Originally Posted by Ritsuka View Post
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.
keeper182 is offline   Reply With Quote
Old 12th April 2022, 07:30   #12  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by keeper182 View Post
while Matrix conv. YCbCR<>RGB is set to BT.601


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 and see what it reports.

Last edited by Sharc; 12th April 2022 at 13:09. Reason: Link added
Sharc is offline   Reply With Quote
Old 12th April 2022, 08:14   #13  |  Link
Ritsuka
Registered User
 
Join Date: Mar 2007
Posts: 95
Quote:
Originally Posted by keeper182 View Post
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.
Ritsuka is offline   Reply With Quote
Old 12th April 2022, 12:32   #14  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
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/...em#post2489032
Sharc is offline   Reply With Quote
Old 13th April 2022, 02:45   #15  |  Link
keeper182
Registered User
 
Join Date: Feb 2022
Posts: 12
Quote:
Originally Posted by Sharc View Post
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/...em#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!
keeper182 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:13.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.