[MPlayer-users] Re: second pass producing the same file as first pass with avcodec, why ?

Rémi Guyomarch rguyom at pobox.com
Mon Apr 15 09:26:01 CEST 2002


On Mon, Apr 15, 2002 at 05:27:28AM +0200, Rémi Guyomarch wrote:
> 
> It seems the second pass in a 2 pass encoding session with avcodec
> produce the exact same output file (down to the byte level) than the
> first one.
> Is there some lack of support for 2 pass encoding in avcodec or is it
> a bug ? Is it a DivX4/XviD-only feature ? Am I a fool ? :-)
> 
> PS: tested with latest cvs of both mplayer/mencoder and ffmpeg's
> libavcodec.

It seems the one-liner below helps a lot ...

Without that, MPV_encode_picture() ignored optimized quantizers given
by the second pass optimizer (divx4_vbr.c in the case of mencoder).

===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpegvideo.c,v
retrieving revision 1.73
diff -u -u -r1.73 mpegvideo.c
--- mpegvideo.c 14 Apr 2002 22:17:40 -0000      1.73
+++ mpegvideo.c 15 Apr 2002 06:55:05 -0000
@@ -538,7 +538,7 @@
     AVPicture *pict = data;
     int i, j;
 
-    if (s->fixed_qscale) 
+    if (s->fixed_qscale || (avctx->flags & CODEC_FLAG_QSCALE)) 
         s->qscale = avctx->quality;
 
     init_put_bits(&s->pb, buf, buf_size, NULL, NULL);

-- 
Rémi




More information about the MPlayer-users mailing list