[MEncoder-users] 3-pass encoding with x264

Olivier Rolland billl at users.sourceforge.net
Wed Apr 21 17:24:23 CEST 2010


On Wed, Apr 21, 2010 at 4:18 PM, Grozdan <neutrino8 at gmail.com> wrote:
> On Wed, Apr 21, 2010 at 4:12 PM, Olivier Rolland
> <billl at users.sourceforge.net> wrote:
>> On Wed, Apr 21, 2010 at 4:03 PM, Grozdan <neutrino8 at gmail.com> wrote:
>>> On Wed, Apr 21, 2010 at 3:54 PM, Olivier Rolland
>>> <billl at users.sourceforge.net> wrote:
>>>> On Wed, Apr 21, 2010 at 3:45 PM, Grozdan <neutrino8 at gmail.com> wrote:
>>>>> On Wed, Apr 21, 2010 at 3:33 PM, Olivier Rolland
>>>>> <billl at users.sourceforge.net> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> In 3-pass encoding, should I use
>>>>>> pass=1 for the 1st pass, pass=3 for the 2nd pass and pass=3 for the 3rd pass
>>>>>> or
>>>>>> pass=1 for the 1st pass, pass=3 for the 2nd pass and pass=2 for the 3rd pass ?
>>>>>>
>>>>>> The man page of mplayer says that I should use the former but mewiki
>>>>>> (http://mewiki.project357.com/wiki/X264_Settings#pass) says that I
>>>>>> should use the later.
>>>>>
>>>>> pass=1 for 1st pass
>>>>> pass=3 for any subsequent pass if you're doing 3 or more passes
>>>>
>>>> So mewiki is wrong ? Or does mplayer modify the pass number before
>>>> sending it to the codec ?
>>>
>>> I don't know much about mewiki, but it's always been like that in
>>> mencoder. And not just for x264, but also for encoding with lavc
>>> codecs (eg, mpeg4, etc)
>>
>> I've just checked the --help of x264 and it says the same as mewiki:
>>
>>  -p, --pass <1|2|3>          Enable multipass ratecontrol
>>                                  - 1: First pass, creates stats file
>>                                  - 2: Last pass, does not overwrite stats file
>>                                  - 3: Nth pass, overwrites stats file
>>
>> I then checked mplayer's code and saw that the pass number is passed
>> as is. I then suspect that the man page of mplayer is wrong and that
>> what is true for lavc is not true for x264.
>
> Then the encoding guide on mplayer's page must be wrong as well....
>
> Three pass encoding? x264 offers the ability to make an arbitrary
> number of consecutive passes. If you specify pass=1 on the first pass,
> then use pass=3 on a subsequent pass, the subsequent pass will both
> read the statistics from the previous pass, and write its own
> statistics. An additional pass following this one will have a very
> good base from which to make highly accurate predictions of frame
> sizes at a chosen quantizer. In practice, the overall quality gain
> from this is usually close to zero, and quite possibly a third pass
> will result in slightly worse global PSNR than the pass before it. In
> typical usage, three passes help if you get either bad bitrate
> prediction or bad looking scene transitions when using only two
> passes. This is somewhat likely to happen on extremely short clips.
> There are also a few special cases in which three (or more) passes are
> handy for advanced users, but for brevity, this guide omits discussing
> those special cases.
>
> http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-x264.html

This text is not necessarily wrong because the pass number of "the
additional pass following this one" is not specified. It can of course
be 3 but it can also be any other value.


More information about the MEncoder-users mailing list