Chapters are doubling up when appending files

I have a two part movie that I am trying to merge into one long file in v77 of the program. It all works fine except the chapters are on top of each other in the final file instead of “appending” like the other file parts.

I have been using MKVToolNix for years and have not seen this before.

Any helpful thoughts?



How mkvmerge handles chapters when appending depends on the UIDs (unique IDs) of those chapters. For each of the appended chapter entry mkvmerge first looks for an existing chapter entry with the same UID.

If an existing one is found, mkvmerge considers both the existing & the one to append to be parts of the same chapter entry. In this case it’ll merge them into a single new entry with the start time of the existing chapter entry & the end timestamp of the appended one.

On the other hand, if no other chapter entry is found, then the appended entry will be kept as a new entry. Its start & end timestamps will be shifted by the duration of all the content the chapters are appended to.

Unfortunately a lot of programs use consecutive numbers as UIDs (1, 2, 3, 4…) instead of random numbers. This means that existing & appended chapters often have the same UID, even though they aren’t actually part of the same logical entry.

What’s actually happening in your case is kind of hard to say as your description of “on top of each other” can mean quite a lot of different things. Can you please extract the chapters from the two original files & from the resulting file & upload them to my file server? I’d like to take a look at their concrete structure. Thanks.

How do I do that? I haven’t extracted chapter before.

EDIT: I see I can export ONLY the chapters to an “mks” file. Is that what you want?

Something else: when I open the resulting combined file in the the program it seems to have ignored the chapters in the second, appended file. It shows the 44 chapters ONLY from the first file.

Either on the command line with mkvextract, or you can use the GUI’s chapter editor:

  1. Load the Matroska file into the chapter editor
  2. Save the chapters via the “Chapter Editor” → “Save as XML file” menu entry.

when I open the resulting combined file in the the program it seems to have ignored the chapters in the second, appended file. It shows the 44 chapters ONLY from the first file.

That sounds like what I described above as the first potential situation: the chapters in the appended file having the same UIDs as existing entries, therefore getting merged into the existing entries.

Done. I zipped them together and put the file on your server.


Yeah, this is due to the chapter UIDs in the appended file matching the ones in the first file. What you can do about it is to re-assign new UIDs to the chapters in the appended file:

  1. Open the file to append (…disc 2…) in the GUI’s chapter editor
  2. Click on each chapter & enter a new UID on the right (they don’t have to be random, they just have to not match any of the existing ones in the first file; e.g. just add 1000 to each of the existing UIDs)
  3. Save the chapters back into the Matroska file

Now try multiplexing again.

OK, so I did that and it did append the 33 chapters from the second part to the 44 chapters from the first part.

However, it started the chapter numbering again where the second file started. IOW, it made chapters 1-44 then 1-33 instead of making 1-77. I was able to fix it by opening the file in the chapter editor and changing them manually there, but I would think that if the files are being appended it would continue the chapter numbering with each appended file, not start them over again.

Is that behavior what I should expect to see?

The problem is that each chapter has a name stored in the Matroska file itself, not just a number. The names could be something sensible like “Opening”, “The Heist”, “Chasing the Robbers”, but often enough they’re simply named “Chapter 1”, “Chapter 2” etc., and that in any language (e.g. “Kapitel 1”, “Kapitel 2”…). mkvmerge does not mess with those names at all.

That being said, if you want to re-apply a simple naming scheme to all entries, just load the chapters of the final file into the chapter editor & right-click on the top-most entry. Select “Renumber sub-chapters” from the context menu.

1 Like