diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-11 17:38:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-11 17:50:14 +0200 |
commit | ce7876cbf4cd3e6f07a36e2fe1e28ca825dd5141 (patch) | |
tree | b1ceaded7c1e7a7adf7488bc9ae2816b8b74287d /libavcodec/ratecontrol.c | |
parent | a990a308835f11461595fa15d66ab4348254bbf6 (diff) | |
download | ffmpeg-streaming-ce7876cbf4cd3e6f07a36e2fe1e28ca825dd5141.zip ffmpeg-streaming-ce7876cbf4cd3e6f07a36e2fe1e28ca825dd5141.tar.gz |
ratecontrol: Dynamically choose a default for rc_max_available_vbv_use
This improves handling of small buffer sizes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r-- | libavcodec/ratecontrol.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 7b8e649..4415d85 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -110,6 +110,13 @@ int ff_rate_control_init(MpegEncContext *s) }; emms_c(); + if (!s->avctx->rc_max_available_vbv_use && s->avctx->rc_buffer_size) { + if (s->avctx->rc_max_rate) { + s->avctx->rc_max_available_vbv_use = av_clipf(s->avctx->rc_max_rate/(s->avctx->rc_buffer_size*get_fps(s->avctx)), 1.0/0.3, 1.0); + } else + s->avctx->rc_max_available_vbv_use = 1.0; + } + res = av_expr_parse(&rcc->rc_eq_eval, s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx); if (res < 0) { av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->avctx->rc_eq); |