Encoding: Insert keyframes at certain positions 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.
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.