3 Splitting imprecise
remuxer32 edited this page 2017-09-16 23:58:25 +02:00

Why does mkvmerge not split where I want it to?

The problem

For example, I tell it to split at timecode 00:02:30, but it splits only at 00:02:36. I've also tried different values, e.g. 00:02:33 or 00:02:28, but it always splits at 00:02:36.

The answer

mkvmerge can only split right before a key frame. This is an intentional limitation that you cannot get around when you use mkvmerge for splitting.

A key frame is a frame type that can be decoded and shown independently of any other frames in the file. That's how mkvmerge ensures that the next file starts with a key frame and can be played correctly right from the start. If mkvmerge allowed splitting at arbitrary timecodes, and therefore at any frame type, then the next file would show disrupted images until the next key frame is encountered.

In general, there is a way to split video files at arbitrary frame positions. This requires that all non-key frames after the split point up to but excluding the next key frame will have to be re-encoded so that the next file does start with a key frame.

However, this requires that the program splitting the video file contains video decoders and encoders for all video formats that it can split. mkvmerge is not such a tool as it does not contain a single decoder or encoder, neither for audio nor for video. That's not its purpose. Therefore mkvmerge will never be able to split before arbitrary frame types.

Categories: merging