[MPlayer-users] Re: Low bitrate using 2-pass with libavcodec

Rémi Guyomarch rguyom at pobox.com
Sun Apr 21 02:14:01 CEST 2002


On Sun, Apr 21, 2002 at 01:38:20AM +0200, Arpi wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> Hi,
> 
> > Don't use vhq on the first pass. The second pass will still be encoded
> > with a lower bitrate than the first, but the difference will be
> > minimal (less than 10%). Adjust the bitrate accordingly. For example,
> > on a 10 minutes sample I specified vbitrate=858 and got 797 on the
> > second pass. The ratio may depend on what you encode.
> 
> i'll fix it next week. the current 2-pass code was made for divx4, and seems
> to always overestimate bitrate of libavcodec.
> i've already wrote code for libavcodec 2pass which works better, at least it
> get +-1mb diff at 700mb filesize, but i'm not staisfied with the bitrate
> control, sometimes produce blocky scenes.

That's very good news ! :-) And it will fix the license problem too.

> > This is a bug in libavcodec and someone from ffmpeg said it will be
> > fixed (ie he is aware of the problem and he knows how to fix it).
>
> currently vfq is disabled (even if user enabled) for -pass 1 

Oh, didn't notice this workaround. But ffmpeg should fix their
encode_video() too to return the real number of bits burned. If I got
it right, it doesn't when 4MV is on.

Btw, you could include 4MV in the list of things not to do on -pass 1 :
(4MV is dependant of HQ so 4MV won't work anyway with -pass 1)

--- libmpcodecs/ve_lavc.c~      Fri Apr 19 09:50:55 2002
+++ libmpcodecs/ve_lavc.c       Sun Apr 21 01:49:51 2002
@@ -149,7 +149,7 @@
            mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile);
            pass=0;
        } else
-           lavc_venc_context.flags &= ~CODEC_FLAG_HQ;
+           lavc_venc_context.flags &= ~(CODEC_FLAG_HQ | CODEC_FLAG_4MV);
        break;
     case 2:
         if (VbrControl_init_2pass_vbr_encoding(passtmpfile,

-- 
Rémi




More information about the MPlayer-users mailing list