Split by frame range: option to snap the start to the previous keyframe

Hello,

I’d like to suggest a small addition to the frame-based split modes.

Currently mkvmerge moves split points forward to the next keyframe. If I want a specific segment to end up entirely inside one part, its first frames are lost to the previous part.

Request: an option to snap the start to the last keyframe at or before the first frame, and the end to the first keyframe after the last frame. The requested segment would then always be fully contained in the middle part, still without re-encoding. A preview of the keyframes actually chosen would also help.

Real example (H.264 Blu-ray, 23.976 fps, frames counted from 0 as in Resolve/Premiere), segment 1256–1701:

  • start keyframe: 1243 (00:00:51.843)
  • end keyframe: 1723 (00:01:11.863)
  • parts: 1243 + 480 + 166018 = 167741 frames, same as the original. Appending them gives no lost or duplicated frames.

I wrote a small Python tool (using ffprobe) that computes these timestamps for the “After specific timestamps” mode. I can share it if useful.

Would this be possible in a future release?

Thanks,
Mimmo

No, that’s not happening, as it would require significant changes to the rather delicate core of mkvmerge to implement some kind of caching. I’m simply not interested or willing to invest the time needed for it.