Log in

View Full Version : x264 - Pass 1 & some questions.


Dogway
1st April 2010, 07:54
I have some questions regarding x264.

1. How exactly works first pass in relation to second pass? Whats the point on using different settings in pass 1?

2. Does the first pass need to be the same as the second? If not what settings should I put for a pass 2 subme 10 veryslow settings? (roughly)

3. Are --vbv-bufsize and -vbv-maxrate relevant settings?

4. Can I auto delete with x264 CLI the .stats after encoding?

5. This last one is a confirmation but do I really need mb-tree for high bitrate encodings? (over 2000 kbps)

Dark Shikari
1st April 2010, 08:50
I have some questions regarding x264.

1. How exactly works first pass in relation to second pass? Whats the point on using different settings in pass 1?There is no point. x264 does it for you.2. Does the first pass need to be the same as the second? If not what settings should I put for a pass 2 subme 10 veryslow settings? (roughly)You should generally use the same settings for both passes and let x264 automatically lower them.3. Are --vbv-bufsize and -vbv-maxrate relevant settings?Relevant to what, kumquats?4. Can I auto delete with x264 CLI the .stats after encoding?Don't see what's stopping you.5. This last one is a confirmation but do I really need mb-tree for high bitrate encodings? (over 2000 kbps)You don't "need" it, but it certainly helps.

Dogway
1st April 2010, 09:15
Well I dont want anything to be done for me except what I want it to do. What I am asking is what it does, so I can weight if its reasonable to let it do.

My question comes from reading a recent thread a days ago which I cant find now, but it shows similar settings as this one (http://forum.doom9.org/showthread.php?t=129049). Here you can see why I wonder about pass 1 configuration, --vbv-bufsize and -vbv-maxrate, --help doesnt help enough (for me). In that thread someone recommended subme 7 pass1 for subme 10 pass 2
I want to know if doing a lossless first pass has any benefit for example. Setting both passes subme10 veryslow, is very slow, I want to optimize settings.

4. The fact of lack of a command for it in x264 stopped me.

Audionut
1st April 2010, 10:09
If you want to specify first pass settings, use --slow-firstpass.

Else just let x264 do its thing. At the end of the day, there are quite a few people working on x264 nowadays, with lots of people to test optimal settings.

Dogway
1st April 2010, 10:11
Yes sorry, I already use --slow-firstpass, Im asking upon that.

LoRd_MuldeR
1st April 2010, 11:02
Yes sorry, I already use --slow-firstpass, Im asking upon that.

But you generally should not use it! Simply use identical settings for both passes and let x264 lower certain settings for the first pass.

x264 will only lower settings in the first pass of a 2-Pass encode and it will only lower settings that have near-zero effect on the final result (after second pass).

By using "--slow-firstpass" you are slowing things down for no benefit. It really should only be used, if you have a very good reason...

(BTW: As far as I know, using VBV only in the second pass is sufficient. However using the same VBV restrictions in both passes shouldn't hurt)

Dogway
1st April 2010, 11:15
Finally someone gets into meat!

That's the whole point of q1 and q2. What good reasons could those be? Anyway if its only aimed to developers then I wont mess with that anymore.
I dont understand why many people use different subme in pass 1 than in pass2, yes for speed, but is it legit?

LoRd_MuldeR
1st April 2010, 11:18
That's the whole point of q1 and q2. What good reasons could those be? Anyway if its only aimed to developers then I wont mess with that anymore.

What does "q1" and "q2" mean?

I dont understand why many people use different subme in pass 1 than in pass2, yes for speed, but is it legit?

...because there was a time (not too long ago) when x264 wasn't smart enough to lower specific unneeded settings in the first pass of a 2-Pass encode automatically for you.

Now it is! And if you look at the help (or the code) you'll see that SubME is limited to a maximum of "2" in the first pass, no matter what you specify! Unless you force "--slow-firstpass", of course ;)


Please see:

void x264_param_apply_fastfirstpass( x264_param_t *param )
{
/* Set faster options in case of turbo firstpass. */
if( param->rc.b_stat_write && !param->rc.b_stat_read )
{
param->i_frame_reference = 1;
param->analyse.b_transform_8x8 = 0;
param->analyse.inter = 0;
param->analyse.i_me_method = X264_ME_DIA;
param->analyse.i_subpel_refine = X264_MIN( 2, param->analyse.i_subpel_refine );
param->analyse.i_trellis = 0;
}
}

Dogway
1st April 2010, 11:41
Thank you. Now everything is clear!

So as for q3 (question 3) do you know what is it for? I couldnt understand much by reading the help. I read once it is oftenly used for HD.

For q4, I know I can do that with batch commands, I just thought if there was some built-in autodelete flag.

Guest
1st April 2010, 13:50
So as for q3 (question 3) do you know what is it for? VBV is used when your stream must be sent over a channel with specific bitrate and buffering constraints. If you are just encoding files to be played back from disk, you don't need VBV.

LoRd_MuldeR
1st April 2010, 16:27
If you are just encoding files to be played back from disk, you don't need VBV.

Except when the "disk" is a BluRay disk. BluRay has strict VBV requirements that must be met to create a valid disk.

But if you aren't encoding your H.264 for either BluRay authoring or network streaming, you probably won't need VBV. And if you don't need VBV, you shouldn't use it.

That's because VBV potentially hurts quality, while it never improves quality. It's just another restriction the encoder has to deal with...

Dogway
1st April 2010, 17:53
No, only for PC playback (I dont wanna bother with restrictions XD)

LoRd_MuldeR
1st April 2010, 18:14
No, only for PC playback (I dont wanna bother with restrictions XD)

Then VBV is not for you :)

Blue_MiSfit
1st April 2010, 19:17
Do keep in mind that you should set a VBV if you're relying on DXVA to decode on your PC.

~MiSfit

Guest
1st April 2010, 19:59
Do keep in mind that you should set a VBV if you're relying on DXVA to decode on your PC. What is your basis for that claim?

Dark Shikari
1st April 2010, 20:02
What is your basis for that claim?DXVA requires a Level 4.1 compliant stream.

nurbs
1st April 2010, 20:04
It will often work if level 4.1 is exceeded, but I agree that it's better to play it safe.

Blue_MiSfit
1st April 2010, 22:26
Indeed. One should at least specify the --level parameter, since this will limit the number of reference frames etc...

Most of my old encodes without any restrictions whatsoever (usually done with settings close to --preset veryslow) don't play nice with DXVA last I checked.

So, to be safe and fit to the standards, I always do my (one pass CRF) encodes within level 4.1 specs.

~MiSfit

Guest
1st April 2010, 23:42
DXVA requires a Level 4.1 compliant stream. Are you also saying that level 4.1 requires VBV?

Dark Shikari
1st April 2010, 23:56
Are you also saying that level 4.1 requires VBV?All H.264 levels specify a maximum CPB inflow rate and CPB buffer size. If you don't set VBV, there's no guarantee x264 will abide by them. In practice, if your bitrate is vastly below the limits, you don't have to worry about it.

xandercage
6th April 2010, 21:47
How much important are settings in 1st pass for final quality results?

Some encoding settigs from .bat file

"F:\x264\x264.exe" --profile high --level 4.1 --preset fast --pass 1 --bitrate 18800 --stats "F:\11.stats" --thread-input --threads 6 --deblock -2:-2 --bframes 6 --b-pyramid normal --b-adapt 2 --direct auto --ref 5 --mixed-refs --vbv-bufsize 30000 --vbv-maxrate 38000 --ratetol 1.0 --qcomp 0.8 --rc-lookahead 60 --mbtree --aq-strength 0.7 --merange 24 --me hex --subme 10 --partitions p8x8,b8x8,i4x4,i8x8 --trellis 2 --no-fast-pskip --no-dct-decimate --output NUL "F:\rep.avs"

"F:\x264\x264.exe" --profile high --level 4.1 --preset fast --pass 2 --bitrate 18800 --stats "F:\11.stats" --thread-input --threads 6 --deblock -2:-2 --bframes 6 --b-pyramid normal --b-adapt 2 --direct auto --ref 5 --mixed-refs --vbv-bufsize 30000 --vbv-maxrate 38000 --ratetol 1.0 --qcomp 0.8 --rc-lookahead 60 --mbtree --aq-strength 0.7 --merange 32 --me esa --subme 10 --partitions p8x8,b8x8,i4x4,i8x8 --trellis 2 --no-fast-pskip --no-dct-decimate --output "F:\reppp.mkv" "F:\rep.avs"

The first pass is over 6fps speed is great. But how much differt in final results is quality vs this settings

"F:\x264\x264.exe" --profile high --level 4.1 --preset placebo --pass 1 --bitrate 18800 --stats "F:\11.stats" --slow-firstpass --thread-input --threads 6 --deblock -2:-2 --bframes 6 --b-pyramid normal --b-adapt 2 --direct auto --ref 5 --mixed-refs --vbv-bufsize 30000 --vbv-maxrate 38000 --ratetol 1.0 --qcomp 0.8 --rc-lookahead 60 --mbtree --aq-strength 0.7 --merange 64 --me umh --subme 10 --partitions p8x8,b8x8,i4x4,i8x8 --trellis 2 --no-fast-pskip --no-dct-decimate --output NUL "F:\rep.avs"

"F:\x264\x264.exe" --profile high --level 4.1 --preset placebo --pass 2 --bitrate 18800 --stats "F:\11.stats" --slow-firstpass --thread-input --threads 6 --deblock -2:-2 --bframes 6 --b-pyramid normal --b-adapt 2 --direct auto --ref 5 --mixed-refs --vbv-bufsize 30000 --vbv-maxrate 38000 --ratetol 1.0 --qcomp 0.8 --rc-lookahead 60 --mbtree --aq-strength 0.7 --merange 64 --me umh --subme 10 --partitions p8x8,b8x8,i4x4,i8x8 --trellis 2 --no-fast-pskip --no-dct-decimate --output "F:\reppp.mkv" "F:\rep.avs"

RunningSkittle
6th April 2010, 22:22
If you dont know what the settings do, why do you change them from defaults presets?

xandercage
6th April 2010, 22:29
If you dont know what the settings do, why do you change them from defaults presets?

Becouse I want know what they do. I do test with differt settings.

RunningSkittle
6th April 2010, 22:44
read "x264 --fullhelp" to find out what the switches do, then just use the preset/tuning system and only change the options you need to change.