Discussion:
[FFmpeg-devel] How to force key frame for h264_qsv encoder?
Chao Liu
2016-08-01 20:20:50 UTC
Permalink
Hi,
Looks like h264_qsv doesn't respect AVFrame.pict_type now.
It always encodes to non-key frames except for the first frame.
Is this a bug of ffmpeg or QSV doesn't support key frames?

Command I use:
ffmpeg -debug_ts -i orig.mp4 -force_key_frames 'expr:gte(t,n_forced)'
-look_ahead 0 -c:v h264_qsv -b:v 800k -maxrate 1600k -preset faster test.mp4
Chao Liu
2016-08-02 22:46:15 UTC
Permalink
Need to add some code like following here
<https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qsvenc.c#L941>
if (frame->pict_type == AV_PICTURE_TYPE_I) {
enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR |
MFX_FRAMETYPE_REF;
}
Post by Chao Liu
Hi,
Looks like h264_qsv doesn't respect AVFrame.pict_type now.
It always encodes to non-key frames except for the first frame.
Is this a bug of ffmpeg or QSV doesn't support key frames?
ffmpeg -debug_ts -i orig.mp4 -force_key_frames 'expr:gte(t,n_forced)'
-look_ahead 0 -c:v h264_qsv -b:v 800k -maxrate 1600k -preset faster test.mp4
Michael Niedermayer
2016-08-03 00:50:23 UTC
Permalink
Post by Chao Liu
Need to add some code like following here
<https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qsvenc.c#L941>
if (frame->pict_type == AV_PICTURE_TYPE_I) {
enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR |
MFX_FRAMETYPE_REF;
}
please send a proper git patch

thx

[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
Loading...