Merge mkv files with time ranges?

I’m having trouble with the syntax. Suppose I want to merge two mkv files specifying a time range in each

I got no responses. Someone must know if this is possible in a single command line. Right now I’m resorting to running one command on each mkv trimming it to the range I want, and then and then another to merge the files the trimmings created. This makes lots of extra files and is tedious.

So is it possible in one command line to list several mkv’s with a range for each and merge into a single mkv?

Oh, I somehow overlooked this even though I could have answered easily; sorry for that.

The answer is: it’s complicated. Technically it is possible via “splitting by parts” (see the fourth variant in the documentation). You can concatenate files & split by timestamps in one go as the splitting timestamps are matched against the concatenated timestamps.

As a simplified example, let’s assume you have to source files: the first one is 2 minutes long, the second one 3 minutes. If you use mkvmerge -o out.mkv in1.mkv + in2.mkv without any splitting, you’ll obviously get a 5 minute file. If you add --split parts:00:30-01:30,01:45-02:15,02:45-04:45 then you’ll get a file that contains 1 minute of content from the first file, 30 seconds of content where both files overlap (half from the first, the other half from the second file) & another 2 minutes from the second file.

The problem is knowing how those timestamps in the output file actually end up as it isn’t always obvious how long mkvmerge things a file is, and therefore by how much the timestamp of concatenated files are shifted. You’ll likely get the actual split timestamps wrong the first try, maybe even the in further tries.

Therefore it is actually quite a bit easier to do what you’re currently doing.

Still confused. Suppose I have two files , file1 and file2, and want to create file3 which has the first 5 minutes of file1 followed by the first 10 minutes of file 2. All togother file 3 would have 15 minutes although the originals are much longer. What would the command line be.