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 5th February 2011, 21:21   #1  |  Link
Gfer
Registered User
 
Join Date: Mar 2006
Posts: 12
Converting Fraps footage with x264, output file's colors become brighter?

I have some 720p footage taken with Fraps that I'm trying to compress with x264 using MeGUI. The problem is, the output file's colors do not look anything like the original video nor the preview in MeGUI. The original file and the preview in MeGUI look identical. They are too bright. How can I fix this? I've tried using the 4 different matrices with ConvertToYV12, the colors look a little better, but not how I would like them to be. Here are some comparative screenshots.

Original, uncompressed:
http://imgur.com/wdP5a.jpg

Compressed with x264:
http://imgur.com/gQa7u.jpg

Will I have to correct this in a editing program?

Encoded with these settings: program --preset slow --pass 2 --bitrate 6000 --stats ".stats" --deblock 0:-2 --bframes 0 --ref 3 --output "output" "input".

Last edited by Gfer; 5th February 2011 at 21:25.
Gfer is offline   Reply With Quote
Old 5th February 2011, 21:44   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,239
-> FAQ: How to correct luminance levels
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 5th February 2011, 23:45   #3  |  Link
Gfer
Registered User
 
Join Date: Mar 2006
Posts: 12
Interesting, by default, MPC-HC sets the range to 0-255, but if I switch it to 16-255 the video looks like it should.
Gfer is offline   Reply With Quote
Old 5th February 2011, 23:52   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,014
What source filter / decoder are you using for the avs script?

AVISource() using the fraps decoder will be RGB (0-255), if you use converttoyv12() it will default to rec601 (Y' 16-235)

FFVideoSource() will decode using full range YUV (Y' 0-255)

Also , The method in which you take screenshots will affect the appearance (ie. which matrix did you use to convert YUV data to RGB for the screenshot)

See
http://forum.doom9.org/showthread.php?t=157941

Last edited by poisondeathray; 6th February 2011 at 05:58.
poisondeathray is offline   Reply With Quote
Old 6th February 2011, 00:15   #5  |  Link
Gfer
Registered User
 
Join Date: Mar 2006
Posts: 12
I'm using AVISource(). I didn't do anything to the fraps video. So how do I use FFVideoSource()? What about audio? I don't have a lot of experience encoding. I used whatever matrix is the default for MPC-HC.
Gfer is offline   Reply With Quote
Old 6th February 2011, 00:28   #6  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,667
x264 by default encodes as TV range.

You must either convert to TV range in your script, or use --fullrange. We have a patch under development to make x264 automatically do --fullrange, but this will not work for Avisynth scripts (it's impossible to judge reliably from an Avisynth script whether the output is fullrange or not).
Dark Shikari is offline   Reply With Quote
Old 20th May 2013, 14:32   #7  |  Link
mzso
Registered User
 
Join Date: Oct 2009
Posts: 894
Quote:
Originally Posted by Dark Shikari View Post
x264 by default encodes as TV range.

You must either convert to TV range in your script, or use --fullrange. We have a patch under development to make x264 automatically do --fullrange, but this will not work for Avisynth scripts (it's impossible to judge reliably from an Avisynth script whether the output is fullrange or not).
Ok. So at present, do I have to use --fullrange with ffmpeg?

How to verify the range with certainty? (The renderer might be good enough to guess/determine the range of the video)

Last edited by mzso; 20th May 2013 at 14:36.
mzso is offline   Reply With Quote
Old 20th May 2013, 16:09   #8  |  Link
vivan
/人 ◕ ‿‿ ◕ 人\
 
Join Date: May 2011
Location: Russia
Posts: 643
Quote:
Originally Posted by mzso View Post
Ok. So at present, do I have to use --fullrange with ffmpeg?

How to verify the range with certainty? (The renderer might be good enough to guess/determine the range of the video)
It's now --input-range PC in x264, probably the same in ffmpeg...

To verify it - open it in properly configured player, e.g. MPC-HC with LAV filters and madVR. madVR should show that range is full in OSD, and colors&brightness of the image should match source.
vivan is offline   Reply With Quote
Old 20th May 2013, 15:40   #9  |  Link
mzso
Registered User
 
Join Date: Oct 2009
Posts: 894
Quote:
Originally Posted by jq963152 View Post
There is another thread over there:

http://forum.doom9.org/showthread.php?t=155772

That seems like an avisynth topic which I don't use. Which part is of interest to me?
mzso is offline   Reply With Quote
Old 20th May 2013, 16:43   #10  |  Link
mzso
Registered User
 
Join Date: Oct 2009
Posts: 894
Quote:
Originally Posted by jq963152 View Post
You asked this:





And the other thread has the answer to it, see:







By the way, the latest HandBrake version (0.9.9 was just released), converts FRAPS YV12 footage ("Force lossless RGB capture (may be slower)" checkbox disabled) better than anything else i'm aware of.

There is a thread about it:

http://forum.doom9.org/showthread.php?t=165680

With the "Force lossless RGB capture (may be slower)" checkbox enabled, HandBrake messes up the colors. But with that checkbox disabled (YV12), HandBrake is quite perfect at converting FRAPS YV12 to x264.

I really would like to know why HandBrake is so good at converting FRAPS YV12.

I still don't know how to convert FRAPS YV12 with AviSynth as good as HandBrake does.
But If I disable lossless "Force lossless RGB capture (may be slower)" I get a lossy video right?
mzso is offline   Reply With Quote
Old 20th May 2013, 17:55   #11  |  Link
mzso
Registered User
 
Join Date: Oct 2009
Posts: 894
Quote:
Originally Posted by jq963152 View Post
No, AFAIK both is lossless, but not 100% sure.

AFAIK the only difference is:

"Force lossless RGB capture (may be slower)" disabled = YCbCr 4:2:0

and:

"Force lossless RGB capture (may be slower)" enabled = RGB (which is 4:4:4)

So, yeah, YCbCr 4:2:0 is not really "lossless", because you loose chroma resolution (4:2:0 vs. 4:4:4). But you are very likely to loose that anyway when you are encoding with x264.

You can encode in YCbCr 4:4:4 and RGB with x264 to keep the chroma resolution, see:

http://forum.doom9.org/showthread.php?t=165415

But the resulting video probably (and unfortunately) will not play back on anything else than PC software.
Well I prefer actual lossless and no subsampling. Since I don't use anything else for playback than a computer the last is a non issue for me. Only if I knew how to get ffmpeg/libx264 to keep the range untouched...
mzso is offline   Reply With Quote
Old 20th May 2013, 19:48   #12  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 677
Quote:
Originally Posted by jq963152 View Post
With the "Force lossless RGB capture (may be slower)" checkbox enabled, HandBrake messes up the colors. But with that checkbox disabled (YV12), HandBrake is quite perfect at converting FRAPS YV12 to x264.

I really would like to know why HandBrake is so good at converting FRAPS YV12.

I still don't know how to convert FRAPS YV12 with AviSynth as good as HandBrake does.
Because when you convert from RGB to YV12 you lose color information. If you record in YV12, most tools won't need to convert because its already YV12. If you judge a YV12 video file produced by fraps, compared to a YV12 H264 you naturally would not see much of a difference, except in the case of the Color Matrix changing for w/e reason.

So, if Handbrake isn't changing the color levels (PC<->TV etc) then that is why it works so well for you.

Its why I loathe Youtube and other streaming services that do not support 4:2:2 or 4:4:4 Color sampling.

When I do game captures I compare the actual game on-screen (PNG/BMP screenshots, etc) to the video file produced during capturing. YV12 always looks horrible to me. Something somewhere, even with tweaking always ends up looking either washed out or oversaturated - i.e it probably takes more effort than I am willing to learn how to precisely convert colors from RGB - > YV12.

So I just gave up on capturing game footage.
osgZach is offline   Reply With Quote
Old 6th February 2011, 00:34   #13  |  Link
Gfer
Registered User
 
Join Date: Mar 2006
Posts: 12
How would I go about converting to TV range in my script? I'll try encoding the video with --fullrange on meanwhile.

Edit: --fullrange on didn't do anything, it still doesn't look right.

Last edited by Gfer; 6th February 2011 at 00:39.
Gfer is offline   Reply With Quote
Old 6th February 2011, 00:56   #14  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,239
Quote:
Originally Posted by Gfer View Post
How would I go about converting to TV range in my script?
http://avisynth.org/mediawiki/Convert#Options
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 6th February 2011, 00:59   #15  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,014
I read your first post incorrectly. If the original and megui preview correlate, then it is likely a playback problem . Read Lord Mulder's post again. (or are you saying they correlate, but are both wrong?)

If you're using overlay mixer in mpchc, then you can calibrate your graphics card overlay settings (this is different than desktop graphics card settings . )

Some players disregard whatever you flag in x264 (the flag doesn't change the actual video data anyway, it's just a suggestion to the player to display as full range or limited range)

Last edited by poisondeathray; 6th February 2011 at 01:02.
poisondeathray is offline   Reply With Quote
Old 6th February 2011, 01:01   #16  |  Link
Gfer
Registered User
 
Join Date: Mar 2006
Posts: 12
Already tried ConvertToYV12(matrix="Rec601") and ConvertToYV12(matrix="Rec709"). Still not working. All I want to do is to compress the fraps footage with x264 into a .mp4 file that can be uploaded to Youtube or viewed in MPC-HC without altering any settings in MPC-HC.

The original and preview correlate. They represent exactly how I want the video.

Last edited by Gfer; 6th February 2011 at 01:09.
Gfer is offline   Reply With Quote
Old 6th February 2011, 02:40   #17  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,667
Quote:
Originally Posted by Gfer View Post
Already tried ConvertToYV12(matrix="Rec601") and ConvertToYV12(matrix="Rec709"). Still not working. All I want to do is to compress the fraps footage with x264 into a .mp4 file that can be uploaded to Youtube or viewed in MPC-HC without altering any settings in MPC-HC.

The original and preview correlate. They represent exactly how I want the video.
That doesn't work. FRAPS decodes as PC-range YV12. Those commands exist to convert RGB to TV-range YV12. But your video is already YV12, so those commands do nothing.
Dark Shikari is offline   Reply With Quote
Old 6th February 2011, 01:12   #18  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,014
Quote:
The original and preview correlate. They represent exactly how I want the video.
If your script for that used ConvertToYV12() (converttoyv12 defaults to rec601) and the original and preview look exactly how you want, then it's likely a playback configuration issue. (ie. you have MPCHC setup incorrectly. )

x264 doesn't change levels when fed YV12 input . i.e. input=output

And youtube always displays as Rec709 (even SD content) - ie. YUV=>RGB conversion for display uses Rec709 matrix, so you will never get it looking 100% identical on youtube.
poisondeathray is offline   Reply With Quote
Old 6th February 2011, 01:21   #19  |  Link
Gfer
Registered User
 
Join Date: Mar 2006
Posts: 12
Is there no way to make the video play correctly out of the box in MPC-HC?
Gfer is offline   Reply With Quote
Old 6th February 2011, 01:24   #20  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,239
Quote:
Originally Posted by Gfer View Post
Then, how do I set up MPC-HC correctly? Is there no way to make the video play correctly out of the box?
Depending on whether the individual player/renderer assumes TV-Levels or PC-Levels by default, the configuration that produces correct display "out-of-the-box" is different

If, for example, you use choose Haali's Renderer or MadVR as your renderer in MPC-HC, you can simply switch the Luminance Levels in the renderer options...

__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 6th February 2011 at 01:28.
LoRd_MuldeR 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 09:08.


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