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. |
17th November 2010, 22:09 | #1 | Link |
Registered User
Join Date: Jan 2010
Posts: 92
|
Making FRAPS video from FFMS2 match AviSource?
FRAPS video is usually YV12. Their VFW codec stores it as YV12, but decodes it to RGB.
FFVideoSource decodes it to fullrange YV12. The problem is that it doesn't look the same as what AVISource (FRAPS) decodes. Example: FRAPS clip, AVISource FRAPS clip, FFVideoSource I also included histograms of the levels. How do I round/shrink FFMS' levels so that they match the levels of AVISource? |
17th November 2010, 22:18 | #2 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
you can try:
smoothlevels(preset="pc2tv") you may have to adjust the settings a bit to make it match, and maybe colormatrix as well (I can't tell , because it's RGB screenshot and it's not clear what you did to take the screenshot (how you converted to RGB)) smoothlevels(preset="pc2tv", chroma=100) colormatrix(mode="rec.709->rec.601" , clamp=0) FRAPS has a RGB mode as well, RGB Lossless , so it depends what version you are using Last edited by poisondeathray; 17th November 2010 at 22:31. |
17th November 2010, 22:28 | #4 | Link |
Registered User
Join Date: Jan 2010
Posts: 92
|
It is closer but unfortunately still noticeably different:
FRAPS, FFVideoSource.smoothlevels(preset="pc2tv") edit: hold on, testing something |
17th November 2010, 22:34 | #5 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
Note: It depends HOW you are taking screenshots , because the YUV data is converted to RGB for the screenshot (or display)
ie. If you converted to RGB using pc vs. tv levels, what matrix (BT 709 vs. 601 etc..) If you use Lossless FRAPS, there is no confusion, because RGB is decoded as RGB, no levels issues |
17th November 2010, 22:45 | #6 | Link |
Registered User
Join Date: Jan 2010
Posts: 92
|
Using Lossless RGB mode in FRAPS makes FRAPS even slower due to the higher bitrate, and the quality difference is not noticeable.
AVISource is not wrong. Example: Screenshot (taken using built-in screenshot utility; a SS from FRAPS looks identical) AVISource, still image from video clip recorded at same approx time FFVideoSource, same as above The screenshot and AVISource are nearly identical; FFVideoSource looks utterly different. Unless the game's screenshot utility is converting PC levels to TV levels, AVISource is correct. I am taking screenshots from the videos using AvsPmod's "Save Image". They are PNG which I then convert to JPG with 4:4:4 chroma. |
17th November 2010, 22:47 | #7 | Link |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Stop willy-nilly converting your screenshots around without considering luma levels! Converting to JPEG can change the levels! Converting to RGB also can change the levels! Going through a video renderer and saving a screenshot (e.g. using AvsPmod's Save Image) can change the levels!
My original statement was just based on your original graphs. Those graphs demonstrate that the data being used to create the graphs shows that AVIsource must be wrong. It's quite possible, of course, that the image is being mangled on the way to creating the graphs, and that AVISource is in fact correct. For example, here's what might be happening: AVISource: Original -> (PC->TV conversion) -> Create Graph -> (PC->TV conversion) FFMS2: Original -> Create Graph -> (PC->TV conversion)
__________________
Follow x264 development progress | akupenguin quotes | x264 git status ffmpeg and x264-related consulting/coding contracts | Doom10 Last edited by Dark Shikari; 17th November 2010 at 22:52. |
17th November 2010, 22:48 | #8 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
Quote:
Try this: ffvideosource() converttorgb(matrix="pc.709") and then examine the screenshot |
|
17th November 2010, 22:55 | #9 | Link | |
Registered User
Join Date: Jan 2010
Posts: 92
|
The images I am using are correct.
Seriously, I was just in the game comparing how the game looks while I'm playing it to how FFVideoSource looks, and FFVideoSource looks wrong. But see below. Quote:
Perfect, this solves the thread title. Code:
FFVideoSource(file) ConvertToRGB(matrix="pc.709") ConvertToYV12() |
|
17th November 2010, 22:58 | #10 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
LOL, don't just convert to RGB then back to YV12 - each conversion is LOSSY . Look at the red borders, they will get blurrier from each colorspace conversion. That example was just to show the proper RGB conversion for taking screenshots (AVSP assumes REC.601 for the RGB conversion otherwise)
You should use the suggestion above, this way you have 1 less colorspace conversion smoothlevels(preset="pc2tv", chroma=100) colormatrix(mode="rec.709->rec.601", clamp=0) Essentially what you are doing is scaling 0-255 to 16-235 Y' then converting to REC.601 - this is not ideal, but a workaround for decoders that expect a TV range video (In avisynth, when you use ConvertToYV12() it means ConvertToYV12(matrix="rec.601") ) FRAPS is supposed to be full range, and decoded full range (converted to RGB full range) - When you compress Y' from 0-255 to 16-235 you get induce quantization (banding) ie. lower quality because there is fewer "steps" to express values Last edited by poisondeathray; 17th November 2010 at 23:03. |
17th November 2010, 23:02 | #11 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
What you WERE doing: AVIsource: Input -> PC->TV Conversion -> Encode -> Decode -> TV->PC conversion -> Display (Correct, but wasteful and hurts quality) FFMS2: Input -> Encode -> Decode -> TV->PC conversion -> Display (WROOOOOOOONG) What you are now doing: FFMS2: Input -> Encode -> Decode -> Display (Optimal!) Now, what we probably should do is make x264 automatically trigger --fullrange if it knows that the input is fullrange. I'll yell at TheFluff to do this. Thanks for the bug report.
__________________
Follow x264 development progress | akupenguin quotes | x264 git status ffmpeg and x264-related consulting/coding contracts | Doom10 Last edited by Dark Shikari; 17th November 2010 at 23:08. |
|
17th November 2010, 23:21 | #12 | Link | |
Registered User
Join Date: Jan 2010
Posts: 92
|
Quote:
Autosetting of fullrange would be really useful, thanks! |
|
17th November 2010, 23:21 | #13 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
^ yes ideally that's what you would do (do everything fullrange) . The problem is decoders and displays might not expect fullrange video or accept VUI information in the h.264 stream, and it will end up looking like the 1st ffvideosource screenshot .
That screenshot is 0-255 YUV data improperly converted to RGB 16-235 using Rec.601 (because he used AVSP to take screenshots without ConvertToRGB(matrix="PC.709") . Using ConvertToRGB(matrix="PC.709") emulates what the YUV data should look like when a decoder/display correctly decodes the fullrange video Scaling it to "TV" levels is the (dumb) workaround for now, but it ensures consistency on every device and display |
17th November 2010, 23:28 | #14 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
Quote:
You can use levels or coloryuv, instead of smoothlevels and it should be faster coloryuv(levels="PC->TV") But smoothlevels does more than just change the levels, it dithers (have a look at the encoded YV12 video in a dark gradient area like shadows, you should see more banding in the video adjusted by levels or coloryuv, but it may or may not be noticable ) |
|
17th November 2010, 23:28 | #15 | Link | |
Registered User
Join Date: Jan 2009
Posts: 1,210
|
Quote:
|
|
17th November 2010, 23:34 | #16 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
Quote:
You don't see the blurring ? http://www.mediafire.com/?t279cf2oa6akg5o |
|
18th November 2010, 00:04 | #17 | Link |
Registered User
Join Date: Jan 2010
Posts: 92
|
I can see the blurring in your sample, yes. I couldn't see it in mine (even looking at an area Subtract marked out).
I don't know if the quality difference is particularly noticeable after the video has gone through YouTube's encode process. |
18th November 2010, 00:16 | #18 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,434
|
Again, it's up to you , and (more) blurry might be better for compression since Youtube brutalizes everything
Youtube converts to RGB for display using Rec.709 (even SD video which should be Rec.601) regardless of flags or format uploaded, so you have to scale to TV levels anyways if it's for Youtube - fullrange isn't an option here |
Tags |
avisource, ffms, ffvideosource, fraps, levels |
Thread Tools | Search this Thread |
Display Modes | |
|
|