[FFmpeg-cvslog] lavc/qsvenc: respect user's setting for keyframes

Haihao Xiang git at videolan.org
Wed May 29 07:24:36 EEST 2024


ffmpeg | branch: master | Haihao Xiang <haihao.xiang at intel.com> | Thu May 23 10:24:36 2024 +0800| [c872ba5899eb520bac313e063336c007852499ea] | committer: Haihao Xiang

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 at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c872ba5899eb520bac313e063336c007852499ea
---

 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 3df355ce78..8200a14012 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -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;
         }
     }



More information about the ffmpeg-cvslog mailing list