How to create a precise cut of a video with MKVToolNix?

I’ve noticed MKVToolNix is not very precise. For instance, if you have it separate a video with the “by parts based on frame/field numbers” option, with a setting like “48860-61846”, it isn’t precise at all. It starts much after 48860, and doesn’t end at 61846 at all, either.

Doing it by timestamp is imprecise as well. The video is a static 60 FPS, there is no odd framerate (23.97, etc.) if that matters.

Welcome!

mkvmerge can only split right before key frames as it doesn’t contain encoders to re-encode incomplete frames located between key frames. If you need more precise editing capabilities, this isn’t the right tool for your job.

1 Like

That’s a shame as I’d prefer to not reencode.

How are you suppoed to know what a keyframe is?

Hi, I am also wondering the same.

I have a 2160p remux HDR (originally tried with a different MKV file that included a DV layer) file and want to cut out/ remove a couple of short scenes.

I initially used the command mkvinfo -s to identify all of the I frames (keyframes) closest to where I wanted to cut.

I then used the split by parts based on timestamps command:
-00:23:11.473000000,+00:24:49.113000000-00:34:39.536000000,+00:35:55.445000000-01:14:46.857000000,+01:17:10.584000000-

The issue I am having is that it still is not a smooth cut despite using exact keyframes. It stutters and pixelates, repeats a frame or two, then speeds up and then after a few seconds returns to normal.

Is there anything else that can be done for a perfectly smooth cut without re-encoding the video?

Thanks

This means that key frames aren’t flagged properly on the container level, especially when the stream is using open GOPs (which is often the case with H.264/H.265). In such a case MKVToolNix simply cannot help you the way you want it to.