lavc/qsvenc: respect user's setting for keyframes

For example:
./ffmpeg -hwaccel qsv -i input.mp4 -force_key_frames:v source -c:v
hevc_qsv -f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
This commit is contained in:
Haihao Xiang 2024-05-23 10:24:36 +08:00
parent dbdd9ccded
commit c872ba5899

View File

@ -2482,7 +2482,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
if (frame->pict_type == AV_PICTURE_TYPE_I) {
enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
if (q->forced_idr)
if ((frame->flags & AV_FRAME_FLAG_KEY) || q->forced_idr)
enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR;
}
}