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 9th July 2012, 14:43   #1  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Posts: 114
FRAPS to x264 to Youtube

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.
kutjong is offline   Reply With Quote
Old 9th July 2012, 18:02   #2  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
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.
Bloax is offline   Reply With Quote
Old 10th July 2012, 00:29   #3  |  Link
nibus
Telewhining
 
Join Date: Mar 2010
Posts: 272
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.
nibus is offline   Reply With Quote
Old 10th July 2012, 07:19   #4  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Posts: 114
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.
kutjong is offline   Reply With Quote
Old 10th July 2012, 09:26   #5  |  Link
Warperus
Registered User
 
Join Date: Apr 2010
Location: Sain-Petersburg, Russia
Posts: 139
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.
Quote:
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.

Quote:
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.

Quote:
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.

Last edited by Warperus; 10th July 2012 at 10:26.
Warperus is offline   Reply With Quote
Old 10th July 2012, 09:35   #6  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Posts: 114
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.
kutjong is offline   Reply With Quote
Old 10th July 2012, 09:58   #7  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,810
Quote:
Capturing in Lagarith YV12 would be quite an optimal solution!
are you going to capture gameplay with this very slow codec?
Atak_Snajpera is offline   Reply With Quote
Old 10th July 2012, 10:25   #8  |  Link
Warperus
Registered User
 
Join Date: Apr 2010
Location: Sain-Petersburg, Russia
Posts: 139
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").
Warperus is offline   Reply With Quote
Old 10th July 2012, 11:11   #9  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Posts: 114
Quote:
Originally Posted by Atak_Snajpera View Post
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?
My processor should be fairly fast, it's an Intel i7 930 @ 4.2GHz.

Quote:
Originally Posted by Warperus
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?

Last edited by kutjong; 10th July 2012 at 11:25.
kutjong is offline   Reply With Quote
Old 10th July 2012, 11:39   #10  |  Link
TheSkiller
Registered User
 
Join Date: Dec 2007
Location: Germany
Posts: 632
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.

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.

Last edited by TheSkiller; 10th July 2012 at 14:20.
TheSkiller is offline   Reply With Quote
Old 10th July 2012, 12:02   #11  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Posts: 114
Quote:
Originally Posted by TheSkiller View Post
To YouTube it does not make a difference whether you use 30.000 fps or 29.97.
Okay, that's good to know!

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

Quote:
Originally Posted by TheSkiller View Post
Legarith is indeed not very fast. Much faster is Ut Video Codec.
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.

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

Last edited by kutjong; 10th July 2012 at 12:20.
kutjong is offline   Reply With Quote
Old 10th July 2012, 14:07   #12  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
Quote:
Originally Posted by TheSkiller View Post
Lagarith is indeed not very fast. Much faster is Ut Video Codec.
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.
Bloax is offline   Reply With Quote
Old 10th July 2012, 14:12   #13  |  Link
TheSkiller
Registered User
 
Join Date: Dec 2007
Location: Germany
Posts: 632
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.

Last edited by TheSkiller; 10th July 2012 at 14:18.
TheSkiller is offline   Reply With Quote
Old 10th July 2012, 15:13   #14  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
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.
Bloax is offline   Reply With Quote
Old 10th July 2012, 15:36   #15  |  Link
TheSkiller
Registered User
 
Join Date: Dec 2007
Location: Germany
Posts: 632
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.
TheSkiller is offline   Reply With Quote
Old 10th July 2012, 15:53   #16  |  Link
Snowknight26
Registered User
 
Join Date: Aug 2007
Posts: 1,430
Quote:
Originally Posted by kutjong View Post
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's how I go from the files Fraps outputs to H.264+AAC in MKV (then MKV->MP4 for when I want them to work with progressive downloading using JW Player).

Last edited by Snowknight26; 10th July 2012 at 16:03.
Snowknight26 is offline   Reply With Quote
Old 10th July 2012, 16:06   #17  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
Quote:
Originally Posted by TheSkiller View Post
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."
Bloax is offline   Reply With Quote
Old 10th July 2012, 16:40   #18  |  Link
TheSkiller
Registered User
 
Join Date: Dec 2007
Location: Germany
Posts: 632
Quote:
Originally Posted by Snowknight26 View Post
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.

Last edited by TheSkiller; 10th July 2012 at 16:43.
TheSkiller is offline   Reply With Quote
Old 10th July 2012, 16:44   #19  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,371
Quote:
Originally Posted by TheSkiller View Post
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

Quote:
NOTE: If range and --input-range differ, then a range conversion will occur!
http://mewiki.project357.com/wiki/X264_Settings#range



Quote:
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
poisondeathray is offline   Reply With Quote
Old 10th July 2012, 18:43   #20  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Posts: 114
Quote:
Originally Posted by Snowknight26 View Post
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's how I go from the files Fraps outputs to H.264+AAC in MKV (then MKV->MP4 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!

Last edited by kutjong; 10th July 2012 at 18:49.
kutjong is offline   Reply With Quote
Reply

Tags
avisynth, encoding, fraps, x264, youtube

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 22:10.


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