1

I am trying to improve the perceived quality of certain predefined frames (like the frames 45, 99, 154, ...). Reason is, that the video is interactive and pauses at these keyframes until the user clicks next. So the quality should be higher just for these frames.

Using ffmpeg, I am currently splitting the video in segments so that each segment starts with one of those important frames as a key frame and then merge it again as a single video. This is suboptimal as lookahead and various other encoder/decoder tweaks can not benefit from this segmented video encoding

Is there a simpler option using -force_key_frames? Unfortunately, this option only seems to allow inserting key_frames using an interval, but the keyframes i require do not follow a rhythm.

P.S. the video is running at a constant 30fps and is merely 32 seconds long. Encoded as x264, vp9 and vp8 for web, so it won't feature a high bitrate.

0

Is there a simpler option using -force_key_frames? Unfortunately, this option only seems to allow inserting key_frames using an interval

Not so. To force keyframes for frames 45, 99 and 154 where first frame has index 0, use

-force_key_frames expr:eq(n,45)+eq(n,99)+eq(n,154)

You may need to escape the commas, depending on your shell.

  • That makes things so much easier and it works very nicely. Thanks a ton Gyan! – David Apr 27 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.