[FFmpeg-devel] [PATCH] libvpx: Disable frame dropping as rate control method

Martin Storsjö martin
Sun Jun 6 23:22:32 CEST 2010


On Sun, 6 Jun 2010, Michael Niedermayer wrote:

> On Sun, Jun 06, 2010 at 11:31:26PM +0300, Martin Storsj? wrote:
> > Hi,
> > 
> > libvpx has the feature of dropping frames as a rate control method, 
> > enabled by default:
> > 
> >   * Temporal resampling allows the codec to "drop" frames as a strategy to
> >   * meet its target data rate. This can cause temporal discontinuities in
> >   * the encoded video, which may appear as stuttering during playback. This
> >   * trade-off is often acceptable, but for many applications is not. It can
> >   * be disabled in these cases.
> > 
> > I'm not particularly fond of this feature, I'd much rather get a bitrate 
> > slightly too high compared to suddenly getting half the framerate. The 
> > attached patch disables this in the libvpx wrapper - is this ok as 
> > default, or should it be changeable through some AVCodecContext field?
> > 
> > // Martin
> >  libvpxenc.c |    1 +
> >  1 file changed, 1 insertion(+)
> > 2e549024a0953c946f20da0379b4f7e1cde99131  0001-libvpx-Disable-frame-dropping-as-rate-control-method.patch
> > From 02cf305dde17a792c584d6b645a49bc9f2a240c6 Mon Sep 17 00:00:00 2001
> > From: Martin Storsjo <martin at martin.st>
> > Date: Sun, 6 Jun 2010 23:27:17 +0300
> > Subject: [PATCH] libvpx: Disable frame dropping as rate control method
> > 
> > ---
> >  libavcodec/libvpxenc.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> > index fa393b8..bdbaaf5 100644
> > --- a/libavcodec/libvpxenc.c
> > +++ b/libavcodec/libvpxenc.c
> > @@ -240,6 +240,7 @@ static av_cold int vp8_init(AVCodecContext *avctx)
> >      //convert [1,51] -> [0,63]
> >      enccfg.rc_min_quantizer = ((avctx->qmin * 5 + 1) >> 2) - 1;
> >      enccfg.rc_max_quantizer = ((avctx->qmax * 5 + 1) >> 2) - 1;
> > +    enccfg.rc_dropframe_thresh = 0;
> 
> should be set based on AVCodecContext.frame_skip*

Ok, so if e.g. avctx->frame_skip_threshold <= 0 (which is the default) we 
should set enccfg.rc_dropframe_thresh = 0, otherwise we keep the default 
rc_dropframe_thresh - or set a value based on the frame_skip_threshold 
value in some way? The value range of frame_skip_threshold doesn't seem to 
be documented in the header.

// Martin



More information about the ffmpeg-devel mailing list