[FFmpeg-devel] [PATCH 1/2] qsvenc: Use scene-change hints from source frame if available
Will Kelleher
wkelleher at gogoair.com
Mon Dec 14 15:02:24 CET 2015
On 12/14, Ivan Uskov wrote:
> Hello Will,
>
> Friday, December 11, 2015, 6:47:28 PM, you wrote:
>
> WK> Since adaptive_i support is broken, this allows the QSV encoder to use scene-
> WK> change hints from the input stream if force_key_frames = source is used. The
> WK> result will be improved transcoding quality at scene change boundaries.
>
> WK> Signed-off-by: Will Kelleher <wkelleher at gogoair.com>
> WK> ---
> WK> libavcodec/qsvenc.c | 11 +++++++++++
> WK> 1 file changed, 11 insertions(+)
>
> WK> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> WK> index d00fdff..74e40f7 100644
> WK> --- a/libavcodec/qsvenc.c
> WK> +++ b/libavcodec/qsvenc.c
> WK> @@ -939,6 +939,17 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q,
> WK> q->set_encode_ctrl_cb(avctx, frame, &qsv_frame->enc_ctrl);
> WK> }
> WK>
> WK> + if (enc_ctrl) {
> + if (frame->>pict_type == AV_PICTURE_TYPE_I) {
> WK> + enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
> WK> + if (frame->key_frame) {
> WK> + enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR;
> WK> + }
> WK> + } else {
> WK> + enc_ctrl->FrameType = 0;
> WK> + }
> WK> + }
> WK> +
> WK> do {
> WK> ret = MFXVideoENCODE_EncodeFrameAsync(q->session, enc_ctrl, surf, bs, &sync);
> WK> if (ret == MFX_WRN_DEVICE_BUSY) {
> Am I understanding right that suggesting feature is non-optional and will
> active always? I believe it should have own option to activate because there
> are negative side effects are possible.
>
This feature is only activated if you use the "force_key_frames" option set to
"source". This isn't an encoder-specific option, it exists at the ffmpeg app
level.
More information about the ffmpeg-devel
mailing list