[FFmpeg-cvslog] libvpxenc: use the default bitrate if not set

Luca Barbato git at videolan.org
Fri Aug 17 17:10:48 CEST 2012


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Thu Aug 16 20:00:53 2012 +0200| [4aa3d7b3f2b71296d73276d62be4e806b34d2d01] | committer: Luca Barbato

libvpxenc: use the default bitrate if not set

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4aa3d7b3f2b71296d73276d62be4e806b34d2d01
---

 libavcodec/libvpxenc.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index c5c522a..3808ac0 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -245,11 +245,16 @@ static av_cold int vp8_init(AVCodecContext *avctx)
     else
         enccfg.g_pass = VPX_RC_ONE_PASS;
 
+    if (!avctx->bit_rate)
+        avctx->bit_rate = enccfg.rc_target_bitrate * 1000;
+    else
+        enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
+                                              AV_ROUND_NEAR_INF);
+
     if (avctx->rc_min_rate == avctx->rc_max_rate &&
         avctx->rc_min_rate == avctx->bit_rate)
         enccfg.rc_end_usage = VPX_CBR;
-    enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
-                                              AV_ROUND_NEAR_INF);
+
     if (avctx->qmin > 0)
         enccfg.rc_min_quantizer = avctx->qmin;
     if (avctx->qmax > 0)



More information about the ffmpeg-cvslog mailing list