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. |
14th August 2011, 08:30 | #1 | Link |
Registered User
Join Date: Aug 2011
Posts: 3
|
Fraps, x264, YV12, avisynth, and youtube
Hello.
I would like to convert my fraps videos to x264 without any colorspace conversion. I hear that fraps does indeed record in yv12, but that it's decoder itself does not decode in yv12, thus forcing a colorspace conversion when converting to x264. So the colors end up worse. Is there a way around this? I want to upload my fraps videos to youtube while sacrificing the least possible color quality. I have looked around for solutions, but none of them have worked so far. Take this one, for example: LoadPlugin("ffms2.dll") LoadPlugin("ColorMatrix.dll") FFVideoSource("FRAPS capture.avi", cache=false) ColorMatrix(inputFR=true) I have tried using this avisynth script, and the video does not open and I get the following error: "Avisynth open failure: ColorMatrix: input to filter must be YV12 or YUV2!" I have both plugins installed (that is, put into the avisynth plugin folder) and have tried the script with fraps videos that were recorded with "force lossless RBG capture" ticked both on and off. If it's relevant to any of this, I have ffdshow installed. Thank you for any help you can provide. |
14th August 2011, 23:59 | #2 | Link |
Registered User
Join Date: Dec 2008
Posts: 589
|
You can configure fraps to encode in RGB24 , then use x264 to encode to YUV 4:4:4 which should be almost lossless. However, Youtube will re-encode your video to YV12, 4:2:0 I'm not sure Flash and video cards support hardware decoding of YV 4:4:4 so probably all popular websites will convert to YV12 anyway... unless you host the video yourself it's probably not going to do you any good.
Have you tried using the plain old AVISource ? As the coded is Video For Windows, it should work... |
15th August 2011, 09:36 | #3 | Link |
Derek Prestegard IRL
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,989
|
I'd bring it down into yv12 inside avisynth. Since it has to go to yv12 eventually, you might as well do it at a stage where you have control over the process.
Code:
FFVideoSource("foo.avi") #Assuming this returns RGB24 or RGB32 ConvertToYV12(matrix="rec709") #Assuming you want to make an HD output? Use matrix="rec601" otherwise.
__________________
These are all my personal statements, not those of my employer :) |
17th August 2011, 00:01 | #4 | Link |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
If ColorMatrix is giving you an error, you're probably recording in lossless mode (which is true RGB24). Untick that box and you'll get YV12. Use Info() to see what the video is currently.
Using the YV12 directly is a little problematic -- FRAPS uses custom YUV coefficients, so ColorMatrix won't be able to fix your colors to what Youtube expects (TV-range Rec.601 -- even for HD). Also, FRAPS YV12 is TV range, not full range.
__________________
Lanczos4, Spline36, what!? Don't know how to pick a resizer? Take a look at my kernel visualizations. Want a high-quality, gamma-aware resizer? Check out my ResampleHQ filter. |
17th August 2011, 11:47 | #5 | Link | ||||
Registered User
Join Date: Aug 2011
Posts: 3
|
Quote:
Quote:
Quote:
Quote:
|
||||
17th August 2011, 23:24 | #6 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
What version of FFMS2 are you using? Current FFmpeg versions have a broken version of a function used to determine the "best" (least lossy) colorspace to convert to, and the Fraps decoder uses the somewhat unusual and deprecated pixel format YUVJ420P (which in Avisynth terms translates to fullrange I420), so it's entirely possible that something goes wrong during the output format decision and FFMS2 decides to output RGB instead. Very recent FFMS2 beta builds have a workaround for this bug, so try that if you haven't already.
|
25th August 2011, 01:33 | #8 | Link |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
I recommend using AviSource to let FRAPS give you RGB. It's the only way to get correct colors.
__________________
Lanczos4, Spline36, what!? Don't know how to pick a resizer? Take a look at my kernel visualizations. Want a high-quality, gamma-aware resizer? Check out my ResampleHQ filter. |
26th August 2011, 12:30 | #9 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
A pointless conversion to RGB and back was exactly what he wanted to avoid in the first place. Also, FFmpeg's fraps decoder explicitly sets its output as fullrange, so I'm not sure where you got the idea that fraps in YV12 is always TV range. Maybe the VFW decoer converts to that?
Last edited by TheFluff; 26th August 2011 at 12:43. |
26th August 2011, 18:53 | #10 | Link | |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
Quote:
FFmpeg's output is using none of the usual YUV coefficients. I don't know if this is a FFmpeg bug or if FRAPS itself just uses something weird.
__________________
Lanczos4, Spline36, what!? Don't know how to pick a resizer? Take a look at my kernel visualizations. Want a high-quality, gamma-aware resizer? Check out my ResampleHQ filter. |
|
26th August 2011, 20:07 | #11 | Link |
Registered User
Join Date: Jul 2011
Posts: 1,121
|
Hmm, i am very interested in this aswell, as i am also trying to prevent the stupid YV12->RGB32->YV12 Conversion:S
I have tried Directshowsource, but it´s the same thing, it decodes as TV Range (i think) when it should be PC Range (or if it´s vice versa). |
26th August 2011, 22:39 | #12 | Link | |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
|
|
28th August 2011, 17:34 | #13 | Link |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
Compare an RGB capture and a YV12 capture. Decode the YV12 twice—once with AviSource() using FRAPS1, and once with FFVideoSource().ConvertToRGB().
Play with the matrix all you like in ConvertToRGB()—you won't be able to match the colors. The closest I've come is with TV-range Rec.709.
__________________
Lanczos4, Spline36, what!? Don't know how to pick a resizer? Take a look at my kernel visualizations. Want a high-quality, gamma-aware resizer? Check out my ResampleHQ filter. |
28th August 2011, 23:02 | #14 | Link | |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
|
|
29th August 2011, 01:15 | #15 | Link |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
sRGB mapped to YV12? I don't think so.
__________________
Lanczos4, Spline36, what!? Don't know how to pick a resizer? Take a look at my kernel visualizations. Want a high-quality, gamma-aware resizer? Check out my ResampleHQ filter. |
14th November 2011, 21:08 | #17 | Link |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
You use RGB with fraps and convert to TV-range Rec.601 YV12 in avisynth (for upload to Youtube). The extra color space conversion, if there is one, is much preferred to using incorrect coefficients.
|
15th November 2011, 21:57 | #19 | Link |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
If your resolution is >=720p and you are not uploading to youtube use rec.709. <720p or uploading to youtube use Rec.601. This is from what I have read about youtube here, not my personal experiance with youtube.
|
16th November 2011, 00:55 | #20 | Link |
Registered User
Join Date: Oct 2009
Posts: 151
|
Strangely I found Rec601 to be the closest to the fraps RGB than any other matrix, even for >720p (though I haven't tried capturing <720p)
Here's comparison, using converttoyv12, matrix : RGB http://i.minus.com/iVwzNF5ComoHr.png Rec601 http://i.minus.com/ibmq7Nip0uyYl7.png PC.601 http://i.minus.com/iuDNl3aVtHqiM.png Rec709 http://i.minus.com/ipoQYVmGYqiF2.png PC.709 http://i.minus.com/icwukCAqr1wJo.png I also have to add --colormatrix bt470bg --fullrange off parameter on x264 or else madvr will treat it as fullrange BT.709 and shows it wrong. |
Tags |
avisynth, decoder, fraps, x264, yv12 |
Thread Tools | Search this Thread |
Display Modes | |
|
|