so, how to use avctx->compression_level option?
------------------ Original ------------------ From: "Jun Zhao";<mypopy...@gmail.com>; Send time: Monday, Aug 21, 2017 11:26 AM To: "FFmpeg development discussions and patches"<ffmpeg-devel@ffmpeg.org>; "Zhong Li"<zhong...@intel.com>; Cc: "sw"<s...@jkqxz.net>; "jun.zhao"<jun.z...@intel.com>; "nfxjfg"<nfx...@googlemail.com>; Subject: Re: [FFmpeg-devel] [PATCH 1/2] vaapi_hevc: Add an option to setquality level On 2017/8/21 11:04, Zhong Li wrote: > Just like vaapi_h264 encoder, quality_level is set for tradeoff quality > and performance. > > Signed-off-by: Zhong Li <zhong...@intel.com> > --- > libavcodec/vaapi_encode_h265.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c > index cf6b9388d1..86bda4a27b 100644 > --- a/libavcodec/vaapi_encode_h265.c > +++ b/libavcodec/vaapi_encode_h265.c > @@ -191,10 +191,19 @@ typedef struct VAAPIEncodeH265Context { > VAEncMiscParameterBuffer misc; > VAEncMiscParameterHRD hrd; > } hrd_params; > + > +#if VA_CHECK_VERSION(0, 36, 0) > + // Speed-quality tradeoff setting. > + struct { > + VAEncMiscParameterBuffer misc; > + VAEncMiscParameterBufferQualityLevel quality; > + } quality_params; > +#endif > } VAAPIEncodeH265Context; > > typedef struct VAAPIEncodeH265Options { > int qp; > + int quality; > } VAAPIEncodeH265Options; > I think now use avctx->compression_level for video quality, not private option, please check 9c878651dbc8c795894740af74670b591551f619 (https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/9c878651dbc8c795894740af74670b591551f619) > > @@ -1198,6 +1207,22 @@ static av_cold int > vaapi_encode_h265_configure(AVCodecContext *avctx) > av_assert0(0 && "Invalid RC mode."); > } > > + if (opt->quality > 0) { > +#if VA_CHECK_VERSION(0, 36, 0) > + priv->quality_params.misc.type = > + VAEncMiscParameterTypeQualityLevel; > + priv->quality_params.quality.quality_level = opt->quality; > + > + ctx->global_params[ctx->nb_global_params] = > + &priv->quality_params.misc; > + ctx->global_params_size[ctx->nb_global_params++] = > + sizeof(priv->quality_params); > +#else > + av_log(avctx, AV_LOG_WARNING, "The encode quality option is not " > + "supported with this VAAPI version.\n"); > +#endif > + } > + > return 0; > } > > @@ -1272,6 +1297,8 @@ static av_cold int > vaapi_encode_h265_init(AVCodecContext *avctx) > static const AVOption vaapi_encode_h265_options[] = { > { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)", > OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS }, > + { "quality", "Set encode quality (trades off against speed, higher is > faster)", > + OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 7, FLAGS }, > { NULL }, > }; > > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel