[Ffmpeg-devel] Intra-frame rate control

Michael Niedermayer michaelni
Fri Apr 6 11:54:09 CEST 2007


dont top post

On Thu, Apr 05, 2007 at 09:29:49PM -0700, RLopez wrote:
> Hi Michael,
> If avcodec.lib can only change Q values at picture boundaries for MPEG2
> files that's a huge limitation.  The advantage of MPEG2 over MJPEG is the
> ability to change the Q in the middle of an image.  A common clip people use
> to show this off is a field of daisies under a blue sky.  The blue sky can
> be encoded well with a high Q value while the more complex field of daisies
> portion of the image can be encoded with a lower Q value.  

libavcodec supports adapting QP based on spatial and or temporal complexity
of macroblocks, if you want to find out how then do as i said and Read The
Fine Manual

> Another problem I'm seeing caused by avcodec.lib only changing Q values at
> picture boundaries is that the instantaneous bitrate of an encoded clip
> jumps around too much.  For example when a complex image follows several
> black frames the bitrate skyrockets because the rate controller lowered the
> Q during the black frames and doesn't readjust it until the end of the
> complex frame.  This problem is especially bad when working with HD images.

the RC algorithm can probably be improved, and patches together with
comparissions of patched vs old encoder are welcome

> If I'm correct that avcodec.lib will only change Q values at picture
> boundaries, could someone point me to which files I could modify to change
> this?  I assume mpegvideo.c would be the main one.

mpegvideo.c and ratecontrol.c are the files you should look at if you want
to play with the ratecontrol code

> On Wed, Apr 04, 2007 at 02:56:24PM -0700, RLopez wrote:
> > I'm trying to use avcodec.lb to encode 1920x1080 frames in MPEG-2.  
> > I've noticed that the Q value for all the slices in each encoded frame 
> > is always constant.  Is this a limitation of avcodec.lib?  In other 
> > words can the rate control only adjust Q values at picture boundaries 
> > and not at slice boundaries?  Is there a setting somewhere to allow 
> > the library to adjust the Q within a frame instead of only at frame
> boundaries.
> RTFM, RTFS and use ffmpeg-user for user questions
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070406/f9ab2a05/attachment.pgp>

More information about the ffmpeg-devel mailing list