View Full Version : FRAPS to x264 to Youtube
kutjong
9th July 2012, 14:43
I've recently started to do video captures with FRAPS. I will also be going to upload a few of them to Youtube. I'd gladly accept some tips regarding the process. :)
This is how I've currently planned it:
1. Record with FRAPS 1080p in RGB lossless mode.
I understand there are problems with YV12 capture?
2. Avisynth script simply:
AviSource("file.avi", pixel_type="RGB32")
ConvertToYV12(matrix="rec709")
3. x264 settings:
High Profile 5.1
Preset medium
Tune film
CRF 22
4. Upload to Youtube.
Regarding the avisynth script, will this automatically make the video in 16-235 levels? Or do I have to enter another line for this conversion?
Also, the profiles in x264, any point to encode in 5.1 or is 4.1 ok? Will 5.1 encode more efficiently?
Ps. I did find a few threads on this on search but it was hard to get any good or conclusive facts on this issue, other than YV12 encoding in FRAPS seems to be dodgy.
Bloax
9th July 2012, 18:02
Whatever isn't RGB in Fraps seems to be working fine. At least from my silly experience.
Also, you don't have to specify the profile for x264.
nibus
10th July 2012, 00:29
If bandwidth isn't an issue, you may want to use a lower CRF value because YouTube will be transcoding it again regardless. You'll have a little better end product if you lower the CRF to 18-20.
kutjong
10th July 2012, 07:19
Thanks for the tips so far! I've found CRF21 to be a kind of sweet spot with quality at a reasonable file size. :)
Anyway, it seems that my comp isn't capable of capturing lossless RGB at 1080p after all, the frame rate can sometimes go under 30, but at YV12 capture it never dips under this.
From what I understand there is no way to preserve the YV12 color space? At least with Avisource the output is always in RGB.
With ffvideosource, it does output YV12, but it is in PC levels. Is there any way to convert to TV levels without converting color space?
As a curiosity, using Avisource and reconverting to YV12 doesn't look that bad, honestly I can't see any loss in image quality. But of course it would be best to avoid the double conversion. :)
Warperus
10th July 2012, 09:26
1) There are no major problems, just unnecessary colorspace conversions: full range RGB(screen)->full range YUV 4:4:4(fraps encode)->full range RGB(vfw fraps decode)->tv range YV12(avisynth).
In case of RGB lossless you'll have RGB values preserved exactly as they were. Fortunately, fraps has no issues with chroma shifts etc. as it processes YUV<->RGB naturally inside codec. Outside fraps always looks like RGB.
2) You did it right.
will this automatically make the video in 16-235 levels?Yes, it will.
3) Level is not really needed. Youtube eats default (unrestricted) settings just fine.
Anyway, it seems that my comp isn't capable of capturing lossless RGB at 1080p after all, the frame rate can sometimes go under 30, but at YV12 capture it never dips under this.Youtube tends to resample movies with more than 30 fps, it produces blending of frames. Looks terrible in stops and produces unreadable flying texts.
In my eyes best bet (sorry, can't avoid this word) is 25.0 or 29.97 fps in fraps without v-sync, then only preserve fps in processing line. You may use more fps for video effects like slowing down some moments, but it's not needed in your case. So don't waste disk space and processor power - set up fps suitable for youtube from very beginning.
Is there any way to convert to TV levels without converting color space?No, not with stock fraps decoder. Besides, as you said, it's looking good anyway.
kutjong
10th July 2012, 09:35
I just found out about another capture program called Dxtory. It seems to be faster and much more configurable than Fraps, you can select any codec of your choice for capture. Capturing in Lagarith YV12 would be quite an optimal solution! :)
I can't try it out at the moment, but it seems that it would be the cure for all the headaches that Fraps causes.
Atak_Snajpera
10th July 2012, 09:58
Capturing in Lagarith YV12 would be quite an optimal solution!
are you going to capture gameplay with this very slow codec?
Warperus
10th July 2012, 10:25
You'll still face color levels conversion with Lagarith. In RGB mode it is similar to fraps - avisource and converttoyuv. In YUV you'll need to do something like Levels("PC->TV").
kutjong
10th July 2012, 11:11
are you going to capture gameplay with this very slow codec?
Hm, I was under the impression that Lagarith is one of the faster lossless codecs. If that's not the case, might Huffyuv or SheerVideo be better choices for lossless realtime capture? :o
My processor should be fairly fast, it's an Intel i7 930 @ 4.2GHz.
You'll still face color levels conversion with Lagarith. In RGB mode it is similar to fraps - avisource and converttoyuv. In YUV you'll need to do something like Levels("PC->TV").
Ok, I think I have to experiment to find the optimal process.
Is it better to use Levels("PC->TV") or Smoothlevels(preset="pc2tv") for luma conversion in YV12?
Edit: Also, is it better to capture in 29.97 fps or 30? Does it make a difference to Youtube?
TheSkiller
10th July 2012, 11:39
To YouTube it does not make a difference whether you use 30.000 fps or 29.97.
SmoothLevels() will give visually nicer results than Levels() but whether or not you can see it depends on the video. If there are lots of fine dark shadings, Levels will most likely give visibly inferior results compared to SmoothLevels. I'd go for SmoothLevels, I hardly ever use Levels anymore.
Legarith is indeed not very fast. Much faster is Ut Video Codec (http://forum.doom9.org/showthread.php?p=1574449#post1574449).
By the way, if you capture in non-RGB mode in Fraps the Fraps codec will convert and downsample to (fullrange) YV12 while recording, therefore the resulting video decoded by Fraps to RGB has only a quarter the chroma resolution.
There are ways to get the raw YV12 out of a Fraps video but the major problem is Fraps uses some weird custom coefficients to convert between YUV and RGB, giving slightly wrong colors if you do not use the Fraps decoder which always decodes to RGB.
Capturing in RGB avoids all that.
kutjong
10th July 2012, 12:02
To YouTube it does not make a difference whether you use 30.000 fps or 29.97.
Okay, that's good to know!
SmoothLevels() will give visually nicer results than Levels() but whether or not you can see it depends on the video. If there are lots of finde dark shadings, Levels will most likely give visibly inferior results compared to SmoothLevels. I'd go for SmoothLevels, I hardly ever use Levels anymore.
That's what I thought, although I suppose Smoothlevels is a little slower.
Legarith is indeed not very fast. Much faster is Ut Video Codec (http://forum.doom9.org/showthread.php?p=1574449#post1574449).
Oh, I hadn't heard about this codec, it seems efficient! Also good that there is some recent development in the field of lossless codec, all the others seem to not have had active development in a long time.
As a sidenote, it would be good have a Wikipedia article about the Ut codec, that's where I was looking for info on different lossless codecs.
By the way, if you capture in non-RGB mode in Fraps the Fraps codec will convert and downsample to (fullrange) YV12 while recording, therefore the resulting video decoded by Fraps to RGB has only a quarter the chroma resolution.
There are ways to get the raw YV12 out of a Fraps video but the major problem is Fraps uses some weird custom coefficients to convert between YUV and RGB, giving slightly wrong colors if you do not use the Fraps decoder which always decodes to RGB.
Capturing in RGB avoids all that.
Just another reason to try and avoid Fraps. RGB capturing seems ok though, but I think most systems and especially HDDs can't handle it at 1080p.
Edit: Doing some checkup on Lagarith, it does seem that the codec has had development not too long ago, back in last december. Reading the changelog, there seems to have been major optimizations, such as multithreading and SSE2. So it might not be so slow after all? Anyway, probably best to do some testing and compare both Lagarith and Ut.
Bloax
10th July 2012, 14:07
Lagarith is indeed not very fast. Much faster is Ut Video Codec (http://forum.doom9.org/showthread.php?p=1574449#post1574449).
I dunno, on all the silly cases I've tested it, it compresses both worse and slower on my C2D E8600.
If I was to present a stupid case I wouldn't have anyways, Lagarith YV12 runs at 35 fps @ 1280x960, UT barely runs at 20.
TheSkiller
10th July 2012, 14:12
Maybe you are forcing Ut Video to convert the color space?
For example, if you have a YUY2 video, you should select "Ut Video (...) 4:2:2" to compress the video and nothing else. For a YV12 video it's the one with "4:2:0" at the end.
Same with RGB sources, only the two RGB choices would be adequate in that case (RGB with or without alpha).
It is true that Legarith does compress a tad better than Ut though but the difference is small.
Edit: The speed figures you present are odd, it should be a lot faster even for Legarith. I have a E8500 and I easily get >100 fps with Ut.
Bloax
10th July 2012, 15:13
I have no idea why it's so slow, either.
Hm, it's not all that much faster for 480p (100/120 fps Lag/Ut, you go judge.) - For 800x600 (AT THE APPROPRIATE COLORSPACE) Ut Is faster. (45 vs. 57 fps)
It's better for those that have enough storage speed, but for those that don't - Lagarith shines bright.
Because just now I've done a little test (the temporal part of this post is amazingly unstable) and Ut is 9 fps slower than Lagarith @ 800x600 at inappropriate colorspaces. (RGB->YV12)
And since I would imagine your GPU outputs RGB, you'd have to pick RGB for Ut. Now - the problem with that is that it's twice as big as Lagarith RGB->YV12.
All while being mighty 10 fps faster than Lagarith doing RGB->YV12.
(And if you don't want it to be twice as big, it'll be 9 fps slower.)
So yeah, for those who don't have storage speed problems, Ut is probably best. But for those that do, Lagarith is a very good candidate.
TheSkiller
10th July 2012, 15:36
To me that still doesn't make sense. In my tests Ut Video Codec results in roughly 5-20% larger files compared to Legarith. Probably depends a lot on the complexibility of the picture.
I'm also always saving the new lossless AVI to a different physical hard disk drive, not the one the source video is being read from for obvious reasons.
Snowknight26
10th July 2012, 15:53
I understand there are problems with YV12 capture?
Not really. In the end the video will be stored as/converted to 4:2:0 so greens/reds won't be sharp regardless of whether you recorded as RGB or YV12. Levels should be fine regardless.
Why don't you let x264 do the conversion from PC to TV levels, skipping the AviSynth step entirely? Simply add --range tv to your x264 command line.
If you're interested, here (http://pastebin.com/iicwN7Sq)'s how I go from the files Fraps outputs to H.264+AAC in MKV (then MKV->MP4 (http://pastebin.com/jEGmYvKK) for when I want them to work with progressive downloading using JW Player).
Bloax
10th July 2012, 16:06
In my tests Ut Video Codec results in roughly 5-20% larger files compared to Lagarith.
And that's what it does. I'm talking about what happens if you actually want it to be faster than Lagarith.
Which it only is in "my" tests when it encodes in the appropriate colorspace (No RGB->YV12, unlike Lagarith - that is).
And thus in "my" tests, Ut would only be faster than Lagarith in RGB mode.
And in RGB mode, it's twice as big as YV12 Lagarith. (oh so surprising)
And (triple "And"!) if we decide to go along with Lagarith and do RGB->YV12 as to not be twice as big, Ut will end up being 9 fps slower than Lagarith. "Oops."
TheSkiller
10th July 2012, 16:40
Why don't you let x264 do the conversion from PC to TV levels, skipping the AviSynth step entirely? Simply add --range tv to your x264 command line.Correct me if I'm wrong but as far as I know x264 never converts the range, it just *flags* the video accordingly. Which is something I would stay away from when it comes to uploading that video to YouTube...
Bloax, so what is this fuss all about? It has been metioned here and elsewhere that Legarith compresses best but at the same time it is one of the slowest lossless codecs out there.
I just think that Ut Video Codec is a good option if you consider that, for many people at least, it is more than twice as fast especially for decoding while the file sizes are not that much bigger... That's the whole point. If you're after the smallest file sizes then yes, Legarith gives somewhat smaller files.
I myself have used Legarith extensively until I came across Ut and found it vastly superiour for it's speed. If you have enough space to deal with lossless videos an increase of a few percent in file size is not dramatic I suppose.
poisondeathray
10th July 2012, 16:44
Correct me if I'm wrong but as far as I know x264 never converts the range, it just *flags* the video accrodingly.
It can and does with newer builds
NOTE: If range and --input-range differ, then a range conversion will occur!
http://mewiki.project357.com/wiki/X264_Settings#range
It has been metioned here and elsewhere that Legarith compresses best but at the same time it is one of the slowest lossless codecs out there.
Actually FFV1 offers slightly better compression
kutjong
10th July 2012, 18:43
Why don't you let x264 do the conversion from PC to TV levels, skipping the AviSynth step entirely? Simply add --range tv to your x264 command line.
If you're interested, here (http://pastebin.com/iicwN7Sq)'s how I go from the files Fraps outputs to H.264+AAC in MKV (then MKV->MP4 (http://pastebin.com/jEGmYvKK) for when I want them to work with progressive downloading using JW Player).
I would like to use this, but that --range tv parameter has no effect on output for me. I've tried with latest versions of Simple x264 launcher and meGUI.
Edit: Nevermind, it seems to be working now. I think I might go for this option, your custom preset works great too, thanks!
kutjong
11th July 2012, 00:02
For anyone interested, here's an example of final product on Youtube.
http://youtu.be/SszWUtSmB98
It does suck to see so much loss in quality when uploading to Youtube, sigh. :(
I have another test from an older game, here it actually looks quite ok in Youtube! But I suppose it's because the source works quite well at lower bitrates since there's not too much happening on screen.
http://youtu.be/smiYpz8Em78
And just to clear up, I used Simple x264 launcher without Avisynth involvement and encoded with these parameters (thanks to Snowknight26):
--crf 18 --preset veryslow --deblock -2:-2 --ref 7 --aq-strength 1 --psy-rd 0.5:0.1 --force-cfr --range tv
Source was Fraps YV12.
TheSkiller
11th July 2012, 14:10
Both look like typical YouTube videos quality wise. So yes, it's mainly YouTube's fault.
I have said this before, in my opinion the "1080p" on YouTube is useless and a waste of traffic as the bitrate is too low for the given video resolution. They'd do better if they ditch 1080p and in return increase the bitrate of 720p, but that's just me.
They would never do that because today it's all about publicity and people only see that 1080 is a greater number than 720, and FullHD and all, so it must be better... :rolleyes:
Anyway, as you can see, if it's going to YouTube the slight loss in color resolution due to YV12 capturing is...invisible.
Mission accomplished.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.