[MEncoder-users] Different parameters in two-pass encoding

James Hastings-Trew jimht at shaw.ca
Tue Feb 3 01:02:47 CET 2009

Stjepan Brbot wrote:
> On Sun, 2009-02-01 at 16:32 -0600, James Hastings-Trew wrote:
>> Stjepan Brbot wrote:
>>> Hi,
>>> several times on Internet and this mailing lists archive I found that
>>> people recommend setting parameter "turbo" in 1st pass encoding while
>>> omitting it in 2nd pass. Or even, to define only subset of parameters in
>>> 1st step and put several additional parameters (like mdb=2:vhq=4) in 2nd
>>> pass. Generally speaking, is this correct? In my opinion 1st pass log is
>>> used for better redistribution of bitrate in 2nd pass encoding but 1st
>>> pass log should be created with exactly the same conditions (encoding
>>> parameters). Isn't it?
>> Keeping all parameters equal during both passes is "more correct" but is 
>> slower. Your final encode might not be perfectly perfect if you specify 
>> faster parameters in the first pass, buy it will be "very close" and a 
>> lot faster. You didn't mention which video codec you are talking about 
>> so it's hard to be specific, but generally on an x264 encode, on the 
>> first pass I will use:
>> bitrate=5000:vbv_maxrate=8000vbv_bufsize=2000:bframes=3:nocabac:nofast_pskip:frameref=1:subq=1:level_idc=31:threads=4:pass=1:turbo
>> And on the second pass I will use:
>> bitrate=5000:vbv_maxrate=8000:vbv_bufsize=2000:bframes=3:partitions=all:me=umh:nocabac:nofast_pskip:nodct_decimate:frameref=6:subq=6:level_idc=31:threads=4:pass=2
>> The first pass goes about 5x faster on my machine than the second pass. 
>> The final file size is very reasonably close to what I wanted, and the 
>> resulting video looks great.
> Thanks James for your answer too about turbo parameter.
> Btw, what's the purpose of using so big bitrate (5000). Don't you get
> almost the as same size of your x264 as your DVD is? Isn't the main
> purpose of all this (I mean DivX/Xvid/x264 video encoding) in achieving
> smaller video files (video compression)?
There are two reasons for encoding with a particular encoder - 1) you 
want to compress the data so it is smaller (and sacrifice a little 
quality), or 2) you have a particular device that requires the data to 
be in a particular format, and file size isn't really an issue. Usually, 
my reasons are #2. The guys who really want to wring every last drop out 
of the file size use much more complicated parameters than I do. I'm 
doing a lot of HD encodes lately, so that's why my bitrate is that 
hight. If you are doing DVD stuff, your bitrate would be about half of 
what I suggested here. The maxrate is also constrained by the playback 
device so it always pays to check the specs. Playback on computer 
doesn't need to worry about that so much, since they generally have fast 
disk I/O and CPUs.

More information about the MEncoder-users mailing list