How do I force keyframes at a given interval to use ffmpeg with h.264_qsv?

I am using the following command to force keyframes to be generated every 5 seconds and set the minimum keyframe interval in ffmpeg.

ffmpeg -i input.mp4 -c:v libx264 -pix_fmt yuv420p -r 24 profile:v baseline -level 3.0 -x264opts keyint=$keyFrameInterval:min-keyint=$keyFrameInterval:no-scenecut:pass=1 -movflags +faststart -strict -2 -acodec aac -y output.mp4

      

This works well with libx264 . Now I am using the following command: h264_qsv . But I can only use keyframes every 5 seconds and couldn't set the minimum keyframe interval.

ffmpeg -hwaccel qsv -i input.mp4 -vcodec h264_qsv -pix_fmt nv12 -preset:v faster -profile:v baseline -level 3.0 -force_key_frames "expr:gte(t,n_forced*5)" -movflags +faststart -strict -2 -acodec aac -f mp4 -r 24 -y output.mp4

      

How can I achieve the above with h264_qsv?

+3


source to share


1 answer


After doing a little research, I found that setting (group of images) -g frameRate * segmentDuration for keyframe interval solved my problem.



0


source







All Articles