Log in

View Full Version : x264 3 pass


Prim3
1st September 2007, 23:29
Hi

I have this script that which is a 2 pass. I would like to add one more pass to it but I'm kind of getting it confused about the stats thing. Because of that, I'm unsure on how to do this.

Also, is it possible to check turbo on in pass 1, in x264 CLI? I prefer CLI rather than MeGUI for some reason.


"C:\Program Files\x264\x264.exe" --pass 1 --bitrate %1 --stats %2.stats --bframes 3 --b-pyramid --subme 1 --analyse none --me dia --progress --no-psnr --output NUL %2

"C:\Program Files\x264\x264.exe" --pass 2 --bitrate %1 --stats %2.stats --ref 8 --mixed-refs --filter 0,0 --no-fast-pskip --bframes 3 --b-pyramid --b-rdo --bime --weightb --subme 7 --trellis 2 --analyse all --8x8dct --me esa --progress --no-psnr --output %2.mkv %2

ECHO.
REM SHUTDOWN -s -t 600
PAUSE
REM SHUTDOWN -a



Thank-you,
Prim3

Atak_Snajpera
1st September 2007, 23:51
Do you really think you will get better quality using 3-passes?

--me esa + --subme 7 + --ref 8 + --trellis 2 + 3rd pass = huge waste of time

I hope you are not encoding in Full HD ? Otherwise You will wait about a week to finish that task.

Nikos
2nd September 2007, 00:13
If you want 3 passes:

First pass:
--pass 1 --bitrate xxx --stats "your_stats.log"

Second pass:
--pass 3 --bitrate xxx --stats "your_stats.log"

Third pass:
--pass 2 --bitrate xxx --stats "your_stats.log"
or --pass 3 --bitrate xxx --stats "your_stats.log"
if you want quarter pass :)

With -- pass 3 the encoder overwrites the stats file.
With --pass 2 does not overwrites the stats file.
I hope you are not encoding in Full HD ? Otherwise You will wait about a week to finish that task.
Maybe two weeks :)

Terranigma
2nd September 2007, 00:35
If you want 3 passes:

First pass:
--pass 1 --bitrate xxx --stats "your_stats.log"

Second pass:
--pass 3 --bitrate xxx --stats "your_stats.log"

Third pass:
--pass 2 --bitrate xxx --stats "your_stats.log"
or --pass 3 --bitrate xxx --stats "your_stats.log"
if you want quarter pass :)

With -- pass 3 the encoder overwrites the stats file.
With --pass 2 does not overwrites the stats file.

That's exactly how Manao does it. I seen Manao's VBV Occupancy test and took a cue. :D

Prim3
2nd September 2007, 04:41
And the rest of the options would go where? I mean, in what pass?

Oh, I'm not encoding in HD btw.

Shinjite
2nd September 2007, 10:35
From my experience, using that full settings with 3 passes and some filtering, a 1 hr 30 minutes DVDRip needs 3 days to encode finish with my P4 2.4@3.24Ghz >.>"

LOL, 2nd and 3rd pass all rendering in 0.67fps, 1st and the last time, no more 3 passes XD

Nikos
2nd September 2007, 13:32
For maximum quality use the same settings in all passes.

akupenguin
2nd September 2007, 13:44
For maximum quality use the same settings in all passes.
"Same" is irrelevant. For maximum quality, use maximum settings on all passes. But if you want to save any cpu time time at all compared to that, then maximum quality per cpu quota is achieved with different options on different passes.

Nikos
2nd September 2007, 14:33
"Same" is irrelevant. For maximum quality, use maximum settings on all passes. But if you want to save any cpu time time at all compared to that, then maximum quality per cpu quota is achieved with different options on different passes.

You are correct, wrong phrase from me :)
I mean maximum quality depend on second pass settings.

What settings have negligible or small effect in final quality during first pass so as i have more speed?

Dark Shikari
2nd September 2007, 18:09
You are correct, wrong phrase from me :)
I mean maximum quality depend on second pass settings.

What settings have negligible or small effect in final quality during first pass so as i have more speed?
--subme 1 will somewhat hurt quality in later passes--I've found --subme 5 in the first pass solves this (and higher --subme has negligable results).

Nikos
2nd September 2007, 19:24
Thanks Dark Shikari for the tip.
Any other settings from a x264 author e.g akupenguin :)

Prim3
2nd September 2007, 23:22
I'd like maximum quality as time isn't a problem for me.

For that, what must I change/add in my current script?

Thanks,
Prim3

Terranigma
3rd September 2007, 00:00
for max quality, you must use max settings. This means impractical settings such as --merange 64, --esa, --trellis-2, --bframes 16, --hadamard, --subme 7, etc... :eek:

Terranigma
3rd September 2007, 00:21
I'v put together a profile for you I think you'd like for megui. :D
It's called HQ-Schizo, get it here (http://www.zshare.net/download/344474924f9f84/)

jult
2nd August 2008, 11:47
I'v put together a profile for you I think you'd like for megui. :D
It's called HQ-SchizoStill have that?
I'm interested in seeing the entire commandline for this profile using x264, with 2 (or 3) passes. And as Prim3 mentioned, time isn't the culprit, the absolute maximum quality is the requirement.

Thanks..

Sharktooth
2nd August 2008, 14:55
more passes doesnt mean more quality!!!!!!!! infact CRF (1 pass) mode gives more quality than RC (2 or more passes) modes.
use more than 2 pass ONLY when ratecontrol isnt able to hit the desired bitrate.

jult
2nd August 2008, 16:22
more passes doesnt mean more quality!!!!!!!! infact CRF (1 pass) mode gives more quality than RC (2 or more passes) modes.
What would be the best way to use --crf and yet still set some type of maximum, the bitrate ceiling?

LoRd_MuldeR
2nd August 2008, 16:25
What would be the best way to use --crf and yet still set some type of maximum, the bitrate ceiling?

There is no way! You once decide which CRF value gives acceptable quality for your eyes and then you use that CRF value for all your encodes.
CRF will use as many bits as required. That's the whole point about CRF. Some files will be bigger (e.g. high motion video) some will be samller (e.g. many static sequences).

If you need to hit a target file size, then use 2-Pass mode with two passes and that's it.

BTW: A 2-Pass encode and a CRF encode of the same average bitrate will be almost identical in quality, only with CRF you cannot predict the final size...

Manao
2nd August 2008, 17:14
infact CRF (1 pass) mode gives more quality than RC (2 or more passes) modesActually, it will give a different result, sometimes better, sometimes worse. In comparison to CRF, pros for 2 passes are :
better I-Frame quantizer choice (the future being known, the rate control knows whether or not the I frame will have an important impact on quality)
better VBV constraints handling, when those are usedCons are the following :
Usually, first pass is done at a lower quality, implying a worse bframe decision quality.
It's slower (after all, there are two passes)
Size constraints complicate the job of the rate control, leading sometimes to uneven quality throughout the encodingFinally, there's one big difference : CRF uses the same algorithm than 2 passes for trading off between quality and bitrate, but the metric the algorithm is based on is different. So the definition of constant quality between CRF and 2 passes will slightly differ

Manao
2nd August 2008, 17:20
You can set up CRF so that the bitrate doesn't go over a certain value by using a VBV. But you don't actually want to do that, because to ensure that the bitrate won't get over that value, VBV will prevent CRF from ever using locally a higher bitrate than max target bitrate. In some cases were CRF without constraints wouldn't have gone beyond the maximum average bitrate, contraining it with a VBV may reduce the quality of the most complex scenes, and will create a smaller file.

Terranigma
3rd August 2008, 01:59
Still have that?
I'm interested in seeing the entire commandline for this profile using x264, with 2 (or 3) passes. And as Prim3 mentioned, time isn't the culprit, the absolute maximum quality is the requirement.

Thanks..

No, it's obsolete and useless. If I were to construct a newer profile, it'd be one based on 2-pass with some of the newer algorithms that are out there.

Sharktooth
3rd August 2008, 15:39
What would be the best way to use --crf and yet still set some type of maximum, the bitrate ceiling?there's no best as per forum rules.

jult
6th August 2008, 16:27
there's no best as per forum rules.Of course there is a "best" answer in this case.
Take for example LAME VBR, with that you have the quantizer/scale, set by -V and you can still set lowest -b and highest -B bitrate used by the VBR engine. This turns out to be extremely useful for both compatibility and streaming reasons. It might not result in optimal quality video when applied with x264, but it is in some cases required, for example to know the bandwidth it will use over time.
As with LAME, you can set VBR to the top level with -V0, yet at the same time set -B192 so bitrate of the encode will never go above 192 kbit/s, and the variable will only push against the max all the time when it would ideally go way over it.

I'm pretty sure you can set this in x264 as well, using CRF. Would be really weird if some type of top (ceiling) and bottom rate did not go into the CLI code as well.

Dark Shikari
6th August 2008, 16:29
I'm pretty sure you can set this in x264 as well, using CRF. Would be really weird if some type of top (ceiling) and bottom rate did not go into the CLI code as well.VBV mode is not recommended with CRF. You should always use 2-pass for maximum VBV compliancy.

Sharktooth
6th August 2008, 16:32
D_S answered for first... and he knows the score...

jult
6th August 2008, 16:40
VBV mode is not recommended with CRF.My example method described with LAME is also "not recommended" with VBR. That's not the answer to my question.

If one would desire to tweak a --crf encode having a ceiling bitrate, what would be the best way? (The time gained not having to do a two-pass versus this trickery still using CRF qualifies in some rare cases, trust me on that..)

Sharktooth
6th August 2008, 16:41
there's no best... :readrule:
the only way to be sure VBV is respected is using 2 (or more) passes. other ways will require more time since compression tests and "trial and error" are needed...

jult
6th August 2008, 16:54
there's no best... :readrule:
the only way to be sure VBV is respected is using 2 (or more) passes. other ways will require more time since compression tests and "trial and error" are needed...In the example I gave the best way is the only way; setting the maximum rate using -Bxxx. Ergo: There is a best method. Of course there is. Best is just a word, it has many different meanings, depending on its context.

Now, if you're saying VBV does not work together with CRF (which I'm not so sure is the case) that's fine, but that's not what DS wrote. I'd like to do things with x264 that aren't generally considered "recommended".

Sharktooth
6th August 2008, 16:59
:readrule: you're not allowed to ask what's best and no... what you said is not the only way. limiting the quantizers (even if less practical) is another way, for example.
here (and IMHO also in real life) the word "best" is subjective and it is what works best for you.
Rule 12:...
Do not ask "what's best" because this question cannot be answered objectively. Each and everyone has their own view about what's best in a certain area. The best is what works best for you!
and by consequence, asserting something is the "best", means nothing... so there'e NO best.
also i didnt say VBV doesnt work with CRF... i said (in other thread) "i dont know" and then (after the D_S intervention) "it doesnt work well with CRF" (still in another thread).
btw, as you see, this thing about 1 pass and VBV has already been discussed... next time, :search: (as per forum rules).
also if you like to do "not recommended" things with x264 or other softwares, dont ask for help. the answer will be always the same... (something like: what you did is not recommended, hence you got problems).

Dark Shikari
6th August 2008, 17:02
In the example I gave the best way is the only way; setting the maximum rate using -Bxxx. Ergo: There is a best method. Of course there is. Best is just a word, it has many different meanings, depending on its context.

Now, if you're saying VBV does not work together with CRF (which I'm not so sure is the case) that's fine, but that's not what DS wrote. I'd like to do things with x264 that aren't generally considered "recommended".The problem is that 1pass VBV can give bad results and has been known to cause quality issues, especially in I-frames. If you have a situation where you can avoid doing it, avoid doing it.

And if Gabriel doesn't respond to my email on the topic soon I'm going to gut a section of his code that has been causing me problems.

Sagittaire
8th August 2008, 08:45
From my experience constrained crf mode don't work very well if the final average bitrate is close to the max bitrate. If you make 6-8 Mbps encoding with 40 Mbps max bitrate and 30 Kbits buffer then you have statiquely less problem for vbv compliancy ...

toyotabedzrock
9th August 2008, 03:11
:readrule: you're not allowed to ask what's best and no... what you said is not the only way. limiting the quantizers (even if less practical) is another way, for example.
here (and IMHO also in real life) the word "best" is subjective and it is what works best for you.
Rule 12:
and by consequence, asserting something is the "best", means nothing... so there'e NO best.
also i didnt say VBV doesnt work with CRF... i said (in other thread) "i dont know" and then (after the D_S intervention) "it doesnt work well with CRF" (still in another thread).
btw, as you see, this thing about 1 pass and VBV has already been discussed... next time, :search: (as per forum rules).
also if you like to do "not recommended" things with x264 or other softwares, dont ask for help. the answer will be always the same... (something like: what you did is not recommended, hence you got problems).

I believe that when asked for the best way given a set of conditions, your answer should be, in my opinion the best way to do that is [your opinion here]. You should then be flattered that someone has perceived you to be knowledgeable about said topic, and has decided to ask your advice.

Comatose
9th August 2008, 03:26
Yes, but you can't really do that on this forum as it's against the rules :P
Instead, you can ask what the readers would use or do in this case... which is kinda silly as it's more or less the same thing.

foxyshadis
11th August 2008, 01:36
Ask what's best: people argue over their own interpretation of best and the settings to get there, with the added bonus that no one really knows what you're looking for. Some want fast, some want extreme, some want balance. Ask what people would do, or just a general 'help!': People still argue over what to do, but generally less often and less intensely, a win for the forum. :p Video viewing is extremely subjective anyway. If you know exactly what you want, better to ask how you achieve that, such as encoding in real time on a dual core, so that you don't get suggestions on the best way to heat your apartment for the next week.