[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mpegvideo.c, 1.503, 1.504 mpegvideo.h, 1.234, 1.235 h263.c, 1.298, 1.299

Corey Hickey bugfood-ml
Mon Jan 30 09:44:47 CET 2006

Michael Niedermayer CVS wrote:
> Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
> In directory mail:/var2/tmp/cvs-serv26933
> Modified Files:
> 	mpegvideo.c mpegvideo.h h263.c 
> Log Message:
> fixing bframe strategy 2
>   bits vs. bytes factor of 8 error
>   16 byte offset error
>   some other minor things

This shows a large improvement over my previous vb_strategy=2 tests and
nets a significant (but a bit varied) improvement. First, my base command:

for i in 1:turbo 2 ; do
  mencoder matrix.vob -aid 128 -oac copy -vf \
crop=718:356:0:60,scale=640:272 -sws 9 -ovc lavc -lavcopts \
last_pred=2:vqcomp=0.6:qpel:sc_factor=6 -ofps 24000/1001 -o test.avi

...and the numeric results:

-------all these have vmax_b_frames=2 as well---------
  pass 1:
PSNR: Y:40.09, Cb:44.35, Cr:44.66, All:41.13
user    45m37.062s
  pass 2:
Video stream:  580.836 kbit/s  (72604 B/s)  size: 593735838 bytes
8177.669 secs  196070 frames
PSNR: Y:42.10, Cb:45.17, Cr:45.87, All:42.97
user    252m58.257s
frame counts: I:   3418  1%  P:  61938 31%  B: 130710 66%
average qps:  I: 3.009655    P: 2.894733    B: 5.003619

  pass 1:
PSNR: Y:40.07, Cb:44.25, Cr:44.54, All:41.09
user    41m29.079s
  pass 2:
PSNR: Y:42.04, Cb:44.98, Cr:45.62, All:42.87
user    215m59.178s
frame counts: I:   3370  1%  P: 117916 60%  B:  74780 38%
average qps:  I: 3.418101    P: 3.483955    B: 5.035330

  pass 1:
PSNR: Y:40.24, Cb:44.40, Cr:44.73, All:41.26
user    163m8.934s
  pass 2:
PSNR: Y:42.18, Cb:45.16, Cr:45.86, All:43.03
user    240m5.035s
frame counts: I:   3346  1%  P:  81506 41%  B: 111214 56%
average qps:  I: 3.053796    P: 3.132776    B: 4.977988

  pass 1:
PSNR: Y:40.17, Cb:44.38, Cr:44.68, All:41.20
user    78m12.731s
  pass 2:
PSNR: Y:42.14, Cb:45.16, Cr:45.86, All:43.00
user    242m8.023s
frame counts: I:   3353  1%  P:  78979 40%  B: 113734 58%
average qps:  I: 3.067104    P: 3.057319    B: 5.016539

  pass 1:
PSNR: Y:40.12, Cb:44.34, Cr:44.64, All:41.15
user    56m58.539s
  pass 2:
PSNR: Y:42.05, Cb:45.09, Cr:45.74, All:42.91
user    237m18.447s
frame counts: I:   3348  1%  P:  88275 45%  B: 104443 53%
average qps:  I: 3.142174    P: 3.050785    B: 5.166358

The encode with vb_strategy=2:brd_scale=0 looks a little bit better in
most high-motion scenes, and _lots_ better in a few. I found one scene
that looks substantially worse, apparantly because instead of being
encoded as a mixture of I-,P-, and B-frames like the vb_strategy=0
encode, it ended up as almost entirely P-frames. It's possible that
re-tuning sc_factor could get a couple I-frames back in there (and in
similar scenes that presumably exist but which I haven't found).

Nevertheless, using vb_strategy=2:brd_scale=0 gives a substantial
improvement overall. The two higher values of brd_scale I tested looked
a bit worse, more or less in accordance with their relative PSNR values.
Note that the 2nd-pass encoding times appear to vary in response to the
number of B-frames used, so using a vb_strategy on the first pass
actually speeds up the second.

------...and all these have vmax_b_frames=3 instead of 2-------
  pass 1:
PSNR: Y:40.02, Cb:44.39, Cr:44.69, All:41.08
user    37m2.615s
  pass 2:
PSNR: Y:42.00, Cb:45.17, Cr:45.87, All:42.89
user    199m9.053s
frame counts: I:   3448  1%  P:  45570 23%  B: 147048 74%
average qps:  I: 2.911253    P: 2.825543    B: 4.955219

  pass 1:
PSNR: Y:40.08, Cb:44.29, Cr:44.60, All:41.11
user    33m13.532s
  pass 2:
PSNR: Y:42.02, Cb:45.00, Cr:45.66, All:42.86
(I messed up and didn't get the time)
frame counts: I:   3372  1%  P: 108774 55%  B:  83920 42%
average qps:  I: 3.381376    P: 3.483479    B: 5.035796

  pass 1:
PSNR: Y:40.32, Cb:44.48, Cr:44.83, All:41.34
user    240m30.314s
  pass 2:
PSNR: Y:42.19, Cb:45.18, Cr:45.90, All:43.04
user    242m32.517s
frame counts: I:   3329  1%  P:  77941 39%  B: 114796 58%
average qps:  I: 3.034545    P: 3.165766    B: 4.923752

I was hoping that using 3 B-frames would be a viable option along with
vb_strategy=2, but that doesn't seem to be the case. Although
vmax_b_frames=3:vb_strategy=2:brd_scale=0 gives 0.01 dB higher PSNR than
using only 2 B-frames, most high-motion scenes look slightly worse and I
didn't find anywhere that looked much better.


More information about the ffmpeg-cvslog mailing list