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

Martin Storsjö martin
Mon Jun 7 09:08:07 CEST 2010


On Sun, 6 Jun 2010, Michael Niedermayer wrote:

> On Mon, Jun 07, 2010 at 12:22:32AM +0300, Martin Storsj? wrote:
> > 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? 
> 
> whatever you like, maybe something in the direction of:
> enccfg.rc_dropframe_thresh= avctx->frame_skip_threshold

Like this, then?

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libvpx-Set-the-libvpx-frame-dropping-threshold-to-fr.patch
Type: text/x-diff
Size: 989 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100607/958e8d8b/attachment.patch>



More information about the ffmpeg-devel mailing list