Message ID | 1631789657-16936-5-git-send-email-lance.lmwang@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/5] avcodec/libsvtav1: Fix redundant setting of caps_internal | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
On Thu, Sep 16, 2021 at 1:55 PM <lance.lmwang@gmail.com> wrote: > > From: Limin Wang <lance.lmwang@gmail.com> > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- For the record, Christopher Degawa also posted something similar (https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210310224859.1726693-1-ccom@randomderp.com/), and I finally recently had gotten to noting on IRC that the rate control options should be brought more in line with, say, libx264. Set AVOption-specific defaults (f.ex., libx264 sets CRF to its default value by default), and then if any of the other rate control modes is nonzero the appropriate rate control would get utilized in the wrapper. Jan
On Fri, Sep 17, 2021 at 01:10:33AM +0300, Jan Ekström wrote: > On Thu, Sep 16, 2021 at 1:55 PM <lance.lmwang@gmail.com> wrote: > > > > From: Limin Wang <lance.lmwang@gmail.com> > > > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > > --- > > For the record, Christopher Degawa also posted something similar > (https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210310224859.1726693-1-ccom@randomderp.com/), I think It's very confusing for the configure for crf, it's 0 as cqp, user had to enable_tpl_la and configure crf also. So I prefer to my proposal. > and I finally recently had gotten to noting on IRC that the rate > control options should be brought more in line with, say, libx264. Set > AVOption-specific defaults (f.ex., libx264 sets CRF to its default > value by default), and then if any of the other rate control modes is > nonzero the appropriate rate control would get utilized in the > wrapper. As rate control options is supported already, so it's better to make crf mode works also. User can use AVOption-specific if can working as expect in future. If CRF is preferable default, I can change the default crf value to 50 instead of -1. > > Jan > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/doc/encoders.texi b/doc/encoders.texi index 64d604e..2300bb9 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1807,9 +1807,11 @@ Set the rate control mode to use. Possible modes: @table @option @item cqp -Constant quantizer: use fixed values of qindex (dependent on the frame type) +Constant quantizer(not set crf): use fixed values of qindex (dependent on the frame type) throughout the stream. This mode is the default. +Constant quality(set crf): maintain a constant QP throughout the stream. + @item vbr Variable bitrate: use a target bitrate for the whole stream. @@ -1826,6 +1828,9 @@ Set the minimum quantizer to use when using a bitrate mode. @item qp Set the quantizer used in cqp rate control mode (0-63). +@item crf +Select the quality for constant quality mode (0-63). + @item sc_detection Enable scene change detection. diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 1f1f86b..29be4bd 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -66,6 +66,7 @@ typedef struct SvtContext { int rc_mode; int scd; int qp; + int crf; int tier; @@ -210,6 +211,10 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, param->min_qp_allowed = avctx->qmin; } else { param->enable_tpl_la = 0; /* CQP need turn off enable_tp_la */ + if ( svt_enc->crf > 0) { + param->qp = svt_enc->crf; + param->enable_tpl_la = 1; + } } /* 2 = IDR, closed GOP, 1 = CRA, open GOP */ @@ -523,13 +528,16 @@ static const AVOption options[] = { { "rc", "Bit rate control mode", OFFSET(rc_mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, VE , "rc"}, - { "cqp", "Constant quantizer", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "rc" }, + { "cqp", "Constant quantizer(not set crf), Constant quality(set crf)", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "rc" }, { "vbr", "Variable Bit Rate, use a target bitrate for the entire stream", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "rc" }, { "cvbr", "Constrained Variable Bit Rate, use a target bitrate for each GOP", 0, AV_OPT_TYPE_CONST,{ .i64 = 2 }, INT_MIN, INT_MAX, VE, "rc" }, { "qp", "Quantizer to use with cqp rate control mode", OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, 63, VE }, + { "crf", "Select the quality for constant quality mode", OFFSET(crf), + AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 63, VE }, + { "sc_detection", "Scene change detection", OFFSET(scd), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, diff --git a/libavcodec/version.h b/libavcodec/version.h index 4b4fe54..b0a741b 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 59 #define LIBAVCODEC_VERSION_MINOR 7 -#define LIBAVCODEC_VERSION_MICRO 103 +#define LIBAVCODEC_VERSION_MICRO 104 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \