[FFmpeg-devel] [PATCH] libvpx: ignore bitrate setting when -crf option is set.
James Zern
jzern at google.com
Mon Dec 17 20:09:36 CET 2012
On Mon, Dec 17, 2012 at 11:06 AM, James Zern <jzern at google.com> wrote:
> On Sat, Dec 15, 2012 at 5:03 PM, Clément Bœsch <ubitux at gmail.com> wrote:
>> avctx->bit_rate is set by default, so unless you use -b:v 0, the CRF
>> settings have no effect, and thus generally results in a pretty crappy
>> quality output.
>> ---
>> libavcodec/libvpxenc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
>> index 0de11b5..cdf9096 100644
>> --- a/libavcodec/libvpxenc.c
>> +++ b/libavcodec/libvpxenc.c
>> @@ -271,7 +271,7 @@ static av_cold int vp8_init(AVCodecContext *avctx)
>> else if (ctx->crf)
>> enccfg.rc_end_usage = VPX_CQ;
>>
>> - if (avctx->bit_rate) {
>> + if (avctx->bit_rate && enccfg.rc_end_usage != VPX_CQ) {
>
> Unfortunately this doesn't work the same as e.g., x264/crf. In this
> mode the target bitrate is actually used as a max, so if the codec
> can't hit the quality it will fallback to vbr mode. Taking the default
> would cause this to happen quite a bit on high resolution content.
>
Some detail [1].
>> enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
>> AV_ROUND_NEAR_INF);
>> } else {
>> --
>> 1.8.0.2
[1] http://www.webmproject.org/docs/encoder-parameters/#3-rate-control
More information about the ffmpeg-devel
mailing list