[FFmpeg-devel] [PATCH 2/2] libvpx: Fix CQ encoding without a specified bitrate

Michael Niedermayer michaelni at gmx.at
Fri Aug 17 21:52:29 CEST 2012


On Fri, Aug 17, 2012 at 11:16:29AM -0700, James Zern wrote:
> On Fri, Aug 17, 2012 at 8:55 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > Also print a warning if neither quality nor bitrate is specified
> > and use the libvpx default bitrate in this case.
> >
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavcodec/libvpxenc.c |   17 +++++++++++++++--
> >  1 file changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> > index b438301..ffe2db7 100644
> > --- a/libavcodec/libvpxenc.c
> > +++ b/libavcodec/libvpxenc.c
> > @@ -270,8 +270,21 @@ static av_cold int vp8_init(AVCodecContext *avctx)
> >          enccfg.rc_end_usage = VPX_CBR;
> >      else if (ctx->crf)
> >          enccfg.rc_end_usage = VPX_CQ;
> > -    enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
> > -                                              AV_ROUND_NEAR_INF);
> > +
> > +    if (avctx->bit_rate) {
> > +        enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
> > +                                                AV_ROUND_NEAR_INF);
> > +    } else {
> > +        if (enccfg.rc_end_usage == VPX_CQ) {
> > +            enccfg.rc_target_bitrate = 1000000;
> > +        } else {
> > +            avctx->bit_rate = enccfg.rc_target_bitrate * 1000;
> > +            av_log(avctx, AV_LOG_WARNING,
> > +                   "Neither bitrate nor contstrained quality specified, using default bitrate of %dkbit/sec\n",
> 
> s/contstrained/constrained/

fixed


> 
> > +                   enccfg.rc_target_bitrate);
> > +        }
> > +    }
> > +
> >      if (avctx->qmin > 0)
> >          enccfg.rc_min_quantizer = avctx->qmin;
> >      if (avctx->qmax > 0)
> > --
> > 1.7.9.5
> >
> Should be ok.

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120817/e6fd083a/attachment.asc>


More information about the ffmpeg-devel mailing list