View Full Version : ABR and 1pass encoding
OpasanNekiLik
4th April 2011, 11:54
As it has been stated in man page of mencoder, bitrate x264 parameter (x264encopts) defines average bitrate (ABR). For two pass encoding process it's clear for me: in first pass the bitrate distribution is calculated and in second pass this distribution is used for multiplying the bitrate resulting in ABR.
But how it is possible to have ABR in only one pass encoding? How encoder could know what variable bitrate to use at the beginning of movie since it does not know how complex the end of movie is?
Dark Shikari
4th April 2011, 12:16
How encoder could know what variable bitrate to use at the beginning of movie since it does not know how complex the end of movie is?Guessing.
OpasanNekiLik
4th April 2011, 13:43
Guessing.
As simple answer as that, guessing!? Could you elaborate that a little bit?
Let's say that I have 10 seconds long video sequence and want to encode it in one pass only with average bitrate=1000kb/s (for every second 1000kb of data is needed). If this is average bitrate that should result in 10s * 1000 kb/s = 10Mb (Mega bits not Mega bytes). So how encoder could know that e.g. first second needs 800kb and 6th second 1300kb? Guessing according to what?
LoRd_MuldeR
4th April 2011, 13:51
Maybe this helps:
http://git.videolan.org/gitweb.cgi?p=x264.git;a=blob;f=doc/ratecontrol.txt;h=e93ced2aa374a4a36fa1f34121358d943a28f6bc;hb=08d04a4d30b452faed3b763528611737d994b30b
See the "1pass, average bitrate" section.
Blue_MiSfit
4th April 2011, 21:19
Very well written explanation. Thanks to pengvado for that!
OpasanNekiLik
5th April 2011, 12:40
Yes this is much better explanation. So the general answer is the catch is in empiria and not only guessing. It is stated that encoder empirically knows how much data is needed for requested quality of particular screen size and it adjusts QP and ratecontrol according to that.
My personal experience is that encoder does it very well. Comparing PSNR and SSIM figures of the same movie (once encoded with only one pass encoding and second time with two pass encoding) I see that the difference is so small (<0.01dB) that it is even questionable whether it is worth spending time on two pass encoding. OK, I know that now someone will call me heretic saying that but that's my experience backed with figures.
LoRd_MuldeR
5th April 2011, 16:43
Yes this is much better explanation. So the general answer is the catch is in empiria and not only guessing. It is stated that encoder empirically knows how much data is needed for requested quality of particular screen size and it adjusts QP and ratecontrol according to that.
I think there's another important point: ABR uses knowledge about the frames that have already been encoded to make an estimate for the (unknown) future frames.
This means that you will start with a very rough estimate, but you will constantly refine your estimate as the encode proceeds.
My personal experience is that encoder does it very well. Comparing PSNR and SSIM figures of the same movie (once encoded with only one pass encoding and second time with two pass encoding) I see that the difference is so small (<0.01dB) that it is even questionable whether it is worth spending time on two pass encoding. OK, I know that now someone will call me heretic saying that but that's my experience backed with figures.
Besides the fact that metrics like PSNR and SSIM only give a very rough estimate about perceived quality, ABR will get close to 2-Pass only if it has enough time to settle.
This might be the case with full-length movies. However with "short" samples the situation might look a bit different...
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.