Log in

View Full Version : purpose of more than two pass encoding


zap_path
8th April 2005, 19:32
If I understand correctly, the purpose of multi-pass encoding is to allow the encoder to plan its bitrate adjustments to achieve constant quality. So the first pass is needed to analyze the video and establish a bits per frame profile. It seems to me you could then multiply this curve by an appropriate constant to get the dersired average bitrate. If that's true, what good would a third or fourth pass do?

Thanks,

-zap_path

jggimi
8th April 2005, 21:19
See:

1-pass QB or Multipass for best quality (http://forum.doom9.org/showthread.php?s=&threadid=46135&highlight=multipass)
DivX 5.05 - Multipass or Two Pass? (http://forum.doom9.org/showthread.php?s=&threadid=52163&highlight=multipass)
Qpel and Multipass (http://forum.doom9.org/showthread.php?s=&threadid=74125&highlight=multipass)
Measuring multipass improvements? (http://forum.doom9.org/showthread.php?s=&threadid=76459&highlight=multipass)
DIVX 5.05 Nth Pass Comparison Alpha3 (http://forum.doom9.org/showthread.php?s=&threadid=53956&highlight=nth) (link is bad but the discussion is good)
What is the point of Nth pass? (http://forum.doom9.org/showthread.php?s=&threadid=72497&highlight=nth)

Have you seen these threads before? If not, see Rule 1 (http://forum.doom9.org/forum-rules.htm). Thank you.

zap_path
9th April 2005, 03:53
Ah, you almost had me there. I have, in fact, already searched the forums and did not find anything on this matter. There seems to have been plenty of discussion about multipass, how many passes do, what settings, etc. Nonetheless, no one asks what I think ought to be the key question: what is the purpose? Mostly, there are a lot of less than enlightening experimental results showing that adding a third pass may or may not make somewhat better looking video. Nowhere is there any mention of WHY a third pass would help or WHAT the encoder is doing during that pass. It seems to me that the encoder has all the information it needs after one pass for optimal rate control and should be able to make a perfectally constant quality video on the second pass. So, if anybody knows what extra passes do, I'm still curious.

Thanks,

-zap_path

DigitAl56K
9th April 2005, 22:31
The purpose is to refine the rate control strategy.

In the first pass you have no idea what the video looks like, or what your data allocation will look like when the video is encoded. So, you run the video through the encoder and log various statistics that might help you refine your data allocation next time around. Some stastistics that are logged by the DivX codec include motion complexity, texture complexity, and bits per frame.

At the start of the second pass you read the first pass log file so that you have a better idea of how the data allocation looks, and which parts of the video are going to require more or less data based on their complexity, so you can form a rate control strategy that will help you achieve your target average bitrate while maintaining a more consistent quality throughout the file.

However, each time you encode the video stream (i.e. during the second pass with the revised rate control) changes in data allocation, algorithm selection, etc. introduced by the new rate control lead to different bit spends, motion complexities, texture complexities, etc.

Ultimately, on each successive pass you are tending closer and closer towards the perfect rate control strategy, based upon some ultimate goal (usually consistent picture quality). Of course, you will never get there. After 2 passes most of the benefit of refining the rate control is realized, and more than 3 passes usually doesn't lead to any visible difference in the output.

The encoder isn't doing one thing in pass 2, and then something else in pass 3 to make the quality better, it is continually refining the rate control on each successive pass based on the statistics from the previous pass.