[MEncoder-users] new doom9 codec comparission (submission)
Corey Hickey
bugfood-ml at fatooh.org
Wed Dec 14 00:10:50 CET 2005
Doom9 Feedback Hotline wrote:
>>Aww, crud. Please do mention that a viable method exists for 3-pass. I'm
>>going to write it up and submit a patch for DOCS/tech/snow.txt.
>
> Well, why the need for 3 passes? Wouldn't a not so smart first pass with
> subsequent passes number 2 and 3 end up okay either way regardless of pass
> 1?
I am 90% sure of the following.
The second pass can meet the target bitrate as long as lmin is
sufficiently low (vqmin is ignored). The second pass of the settings I
gave you came up short because the default lmin=2 was too high. Snow is
more efficient than mpeg-4 and needs to have lower quantizers to use as
much data.
The PSNR and quality of the final pass suffers greatly if the average
bitrate of the previous pass was not reasonably close to the target
bitrate. Also, it's better to have the previous pass' average bitrate be
higher than the target rather than lower (if the absolute value of the
difference is close to the same). For example, with a target bitrate of
581, a first-pass average of 681 would be better than 481, but 570 would
be much better than either just because it's much closer.
In 2-pass encoding, if you don't pick a quantizer that yields bitrate
close to the target bitrate, you don't get good results.
In 3-pass encoding the final pass is working off the average bitrate of
the second pass, which is nearly exact. So, it almost doesn't matter
what quantizer you choose for the first pass. With each subsequent pass,
the ratecontrol converges on the optimal allocation. The convergence is
rapid, so two more passes is sufficient.
> And what would the 3 pass encoding method be?
Ideally, a 3-pass method would work for all cases, regardless of
bitrate. Unfortunately, I can't provide that for two reasons.
1. The default value for lmin, 2, is too high if the movie is too easy
for snow to encode at the target bitrate.
2. Lowering lmin too far results in snow using quantizers for some
scenes that are lower than necessary and forces other scenes to use
higher quantizers. This looks a little bit better in low-motion parts of
the movie and much worse in high-motion parts.
The best compromise I have, at this point, is to use 3-pass encoding and
simply lower lmin when it becomes necessary.
pass 1: vpass=1:vqscale=1
*At this point, make a backup of divx2pass.log.
pass 2: vpass=3:vbitrate=xxx:lmin=2 <--that's the default
*Was the target bitrate met? If not, overwrite divx2pass.log with the
backup, lower lmin by 0.2 and try again.
pass 3: vpass=3:vbitrate=xxx:lmin=y.y
Now, you may be wondering how this is better than simply using binary
search to find an appropriate first-pass quantizer and using 2-pass
encoding after that. In many cases (such as my copy of The Matrix at the
specified resolution) it's not necessary to alter lmin. Even if it is
(such as your copy), you can almost always find the right value in one
more attempt. Having lmin too low by a difference of 0.2 has very little
effect on quality, so tuning lmin precisely is not needed. Compare this
to using numerous attempts at the first pass to narrow down vqscale
precisely.
It's not ideal, but the best I have so far.
-Corey
More information about the MEncoder-users
mailing list