mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-09 01:07:01 +02:00
libvpxenc: Fix CQ encoding without a specified bitrate
Also print a warning if neither quality nor bitrate is specified and use the libvpx default bitrate in this case. The idea of using the default bitrate is from Luca Barbato Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
1ee7a2955f
commit
ceb8773e16
@ -270,8 +270,21 @@ static av_cold int vp8_init(AVCodecContext *avctx)
|
|||||||
enccfg.rc_end_usage = VPX_CBR;
|
enccfg.rc_end_usage = VPX_CBR;
|
||||||
else if (ctx->crf)
|
else if (ctx->crf)
|
||||||
enccfg.rc_end_usage = VPX_CQ;
|
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 constrained quality specified, using default bitrate of %dkbit/sec\n",
|
||||||
|
enccfg.rc_target_bitrate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (avctx->qmin > 0)
|
if (avctx->qmin > 0)
|
||||||
enccfg.rc_min_quantizer = avctx->qmin;
|
enccfg.rc_min_quantizer = avctx->qmin;
|
||||||
if (avctx->qmax > 0)
|
if (avctx->qmax > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user