[MPlayer-dev-eng] DivX5 & VBR encoding

Michael Niedermayer michaelni at gmx.at
Mon Sep 9 16:44:00 CEST 2002


Hi

On Monday 09 September 2002 04:15, Kim Minh Kaplan wrote:
> D Richard Felker III writes:
[...]
> > is quite different. Are there papers on the issue?
>
> IBM Journal of Research and Development published "Two-pass MPEG-2
> variable-bit-rate encoding".  See
> <URL:http://researchweb.watson.ibm.com/journal/rd/434/westerink.html>.
> That's the only interesting one I found so far.
hmm, its allso the only paper i ever found about 2pass encoding, perhaps its 
the only one ;)

[...]
> I have read and understood how divx4_vbr works (it's mostly what is
> described in IBM's paper).  I once tried to read xvid_vbr but it is
> much more complex and have not yet understood it.  Now how does lavc's
> VBR work?  Would it be usable for DivX?
hmm, it should be possible, (dunno how clean it will look though)
1a. allocate a MpegEncContext & AVCodecContext and initalize the ratecontrol 
specific stuff (qmin, qmax, ...)
1b. for pass 2. put the stats from pass1 in AVCodecContext.stats_in
1c. call ff_rate_control_init()

2a. for every frame set (mc_)mb_var_sum (u might have to set them to 
constants, i doubt these are available from divx) then call 
ff_rate_estimate_qscale()
to get the quantizer for the current frame
2b. for pass 1 call ff_write_pass1_stats() with the stats stored in 
MpegEncContext for each frame this will give u a string in 
AVCodecContext.stats_out which u can store in a file or array or whatever

3. call ff_rate_control_uninit(s);

PS: i have surely forgotten many things, so check libavcodec/ratecontrol.c 
libmpcodecs/ve_lavc.c and libavcodec/mpegvideo.{c,h} libavcodec/avcodec.h

[...]

Michael



More information about the MPlayer-dev-eng mailing list