[Ffmpeg-devel] [PATCH] increase max numbers of B frames

Erik Slagter erik
Wed Feb 22 19:39:31 CET 2006


On Tue, 2006-02-21 at 13:07 -0800, Loren Merritt wrote:

> Do not compare just bitrate. Remember that one of the reasons
> B-frames 
> improve compression is that they allow asymmetric allocation of
> quality, 
> whereby the B-frames are quantized more and the P-frames less. But if
> you 
> encode with constant QP, then it quantizes B-frames more and doesn't 
> change the P-frames to match, thus decreasing overall quality a
> little. 
> You could encode with a different constant QP, but QP's granularity is
> too 
> coarse for such a comparison.
> So run 2pass encodes with the same target bitrate, and compare PSNR
> or 
> other quality metric. (That being easier than encoding with a target
> PSNR 
> and comparing bitrate.) Keeping in mind that PSNR sucks, it's still
> better 
> than ignoring quality entirely.

So this is what I did, I ran mencoder with this (x264enc opts) command
line with bframes = 0..5 (didn't try higher values, no interesting
results...)

-x264encopts "pass=$pass:turbo=$turbo:nofast_pskip:bframes=
$b:nr=500:bitrate=2000:vbv_maxrate=9000:vbv_bufsize=5000:scenecut=-1:threads=2" 

pass = [0,1], turbo is 1 when pass is 0 and vv.

The result is that average qp goes down just a little bit when going
from 0 to 1 bframes, after that the difference really is insignificant.

Am I doing something wrong here?

Attached the relevant output.

-------------- next part --------------

B frames = 0

x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:23.38  size: 30872
x264 [info]: slice P:1992  Avg QP:26.11  size:  9936
x264 [info]: mb I  I16..4: 39.2%  0.0% 60.8%
x264 [info]: mb P  I16..4: 20.6%  0.0%  4.3%  P16..4: 44.6% 15.5%  4.8%  0.0%  0.0%    skip:10.2%
x264 [info]: kb/s:2004.0
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:23.25  size: 30617
x264 [info]: slice P:1992  Avg QP:25.98  size:  9926
x264 [info]: mb I  I16..4: 37.7%  0.0% 62.3%
x264 [info]: mb P  I16..4: 17.9%  0.0%  3.7%  P16..4: 42.9% 19.1%  6.2%  0.0%  0.0%    skip:10.3%
x264 [info]: kb/s:2001.8

B frames = 1

x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:23.62  size: 31746
x264 [info]: slice P:1113  Avg QP:25.03  size: 13540
x264 [info]: slice B:879   Avg QP:27.61  size:  5327
x264 [info]: mb I  I16..4: 38.9%  0.0% 61.1%
x264 [info]: mb P  I16..4: 24.1%  0.0%  8.4%  P16..4: 38.7% 16.5%  6.0%  0.0%  0.0%    skip: 6.4%
x264 [info]: mb B  I16..4:  1.8%  0.0%  1.6%  B16..8: 34.4%  0.0%  0.0%  direct:14.8%  skip:47.4%
x264 [info]: kb/s:2000.6
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:22.25  size: 34264
x264 [info]: slice P:1113  Avg QP:24.92  size: 13420
x264 [info]: slice B:879   Avg QP:27.43  size:  5471
x264 [info]: mb I  I16..4: 35.5%  0.0% 64.5%
x264 [info]: mb P  I16..4: 22.3%  0.0%  7.2%  P16..4: 35.6% 19.9%  8.2%  0.0%  0.0%    skip: 6.8%
x264 [info]: mb B  I16..4:  1.6%  0.0%  1.1%  B16..8: 32.7%  1.7%  4.6%  direct:10.5%  skip:47.7%
x264 [info]: kb/s:2001.9

B frames = 2

x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:23.62  size: 31692
x264 [info]: slice P:1090  Avg QP:25.05  size: 13675
x264 [info]: slice B:902   Avg QP:27.57  size:  5379
x264 [info]: mb I  I16..4: 39.1%  0.0% 60.9%
x264 [info]: mb P  I16..4: 24.1%  0.0%  8.6%  P16..4: 38.4% 16.5%  6.0%  0.0%  0.0%    skip: 6.4%
x264 [info]: mb B  I16..4:  1.9%  0.0%  1.7%  B16..8: 35.1%  0.0%  0.0%  direct:14.5%  skip:46.8%
x264 [info]: kb/s:2001.1
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:22.25  size: 34315
x264 [info]: slice P:1090  Avg QP:24.93  size: 13563
x264 [info]: slice B:902   Avg QP:27.38  size:  5513
x264 [info]: mb I  I16..4: 35.6%  0.0% 64.4%
x264 [info]: mb P  I16..4: 22.4%  0.0%  7.3%  P16..4: 35.4% 19.9%  8.3%  0.0%  0.0%    skip: 6.6%
x264 [info]: mb B  I16..4:  1.7%  0.0%  1.1%  B16..8: 33.3%  1.8%  4.6%  direct:10.4%  skip:47.1%
x264 [info]: kb/s:2003.1

B frames = 3

x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:23.62  size: 31692
x264 [info]: slice P:1090  Avg QP:25.05  size: 13675
x264 [info]: slice B:902   Avg QP:27.57  size:  5379
x264 [info]: mb I  I16..4: 39.1%  0.0% 60.9%
x264 [info]: mb P  I16..4: 24.1%  0.0%  8.6%  P16..4: 38.4% 16.5%  6.0%  0.0%  0.0%    skip: 6.4%
x264 [info]: mb B  I16..4:  1.9%  0.0%  1.7%  B16..8: 35.1%  0.0%  0.0%  direct:14.5%  skip:46.8%
x264 [info]: kb/s:2001.1
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:22.25  size: 34317
x264 [info]: slice P:1090  Avg QP:24.92  size: 13574
x264 [info]: slice B:902   Avg QP:27.38  size:  5514
x264 [info]: mb I  I16..4: 35.5%  0.0% 64.5%
x264 [info]: mb P  I16..4: 22.4%  0.0%  7.3%  P16..4: 35.4% 19.9%  8.3%  0.0%  0.0%    skip: 6.6%
x264 [info]: mb B  I16..4:  1.7%  0.0%  1.1%  B16..8: 33.4%  1.8%  4.6%  direct:10.4%  skip:47.1%
x264 [info]: kb/s:2004.4

B frames = 4

x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:23.62  size: 31692
x264 [info]: slice P:1090  Avg QP:25.05  size: 13675
x264 [info]: slice B:902   Avg QP:27.57  size:  5379
x264 [info]: mb I  I16..4: 39.1%  0.0% 60.9%
x264 [info]: mb P  I16..4: 24.1%  0.0%  8.6%  P16..4: 38.4% 16.5%  6.0%  0.0%  0.0%    skip: 6.4%
x264 [info]: mb B  I16..4:  1.9%  0.0%  1.7%  B16..8: 35.1%  0.0%  0.0%  direct:14.5%  skip:46.8%
x264 [info]: kb/s:2001.1
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:22.25  size: 34340
x264 [info]: slice P:1090  Avg QP:24.92  size: 13580
x264 [info]: slice B:902   Avg QP:27.37  size:  5517
x264 [info]: mb I  I16..4: 35.4%  0.0% 64.6%
x264 [info]: mb P  I16..4: 22.4%  0.0%  7.3%  P16..4: 35.4% 19.9%  8.3%  0.0%  0.0%    skip: 6.6%
x264 [info]: mb B  I16..4:  1.7%  0.0%  1.1%  B16..8: 33.4%  1.8%  4.6%  direct:10.3%  skip:47.1%
x264 [info]: kb/s:2005.3

B frames = 5

x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:23.62  size: 31692
x264 [info]: slice P:1090  Avg QP:25.05  size: 13675
x264 [info]: slice B:902   Avg QP:27.57  size:  5379
x264 [info]: mb I  I16..4: 39.1%  0.0% 60.9%
x264 [info]: mb P  I16..4: 24.1%  0.0%  8.6%  P16..4: 38.4% 16.5%  6.0%  0.0%  0.0%    skip: 6.4%
x264 [info]: mb B  I16..4:  1.9%  0.0%  1.7%  B16..8: 35.1%  0.0%  0.0%  direct:14.5%  skip:46.8%
x264 [info]: kb/s:2001.1
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow! 
x264 [info]: slice I:8     Avg QP:22.25  size: 34329
x264 [info]: slice P:1090  Avg QP:24.92  size: 13579
x264 [info]: slice B:902   Avg QP:27.36  size:  5526
x264 [info]: mb I  I16..4: 35.5%  0.0% 64.5%
x264 [info]: mb P  I16..4: 22.4%  0.0%  7.3%  P16..4: 35.4% 19.9%  8.3%  0.0%  0.0%    skip: 6.6%
x264 [info]: mb B  I16..4:  1.7%  0.0%  1.1%  B16..8: 33.4%  1.8%  4.6%  direct:10.4%  skip:47.0%
x264 [info]: kb/s:2006.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2771 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060222/2da56bed/attachment.bin>



More information about the ffmpeg-devel mailing list