VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Member Todd Sauve's Avatar
    Join Date
    Mar 2012
    Location
    Calgary, Alberta
    Search Comp PM
    Hi all,

    I have ripped a dual layer DVD that has a concert divided into two separate parts. Everything ended up in one Video TS folder. I then used Handbrake to convert the concert into two separate MKV files, including their chapters. Handbrake identified that there were multiple DVDs in the Video TS folder and allowed me to convert them into MKVs separately.

    However, when I try to use MKVToolNix to merge the two MKVs into a single file, the chapters gets screwed up everytime. I add the first MKV and then use the Append button to add the second MKV, which produces a perfectly good single MKV file with the video and audio all in their correct places one after the other. Even so, the chapters from the second MKV simply refuse to act like the video and audio and append themselves to the first MKV file. All I get are the chapters from the first MKV spread over the entire length of the combined MKV, with the second file's chapters lost in action.

    What process do I have to follow to get the chapters from the two MKVs to merge in their correct order and then mux into the single combined MKV file?

    Please be exacting and walk me through this step by step. I am assuming that MKVToolNix can do this but maybe I am wrong. I am horrible with command line options, so let's do it the good old GUI way!

    It seems to me that I used to be able to extract chapter files individually from an MKV using this program but now all I get is errors whenever I try to do it. I load the MKV into the program and then uncheck the video and audio checkboxes, leaving only the chapters with a checkmark but it refuses to do what I want.

    I have managed to extract each DVDs chapters using a program called ChapterXtractor but I don't know how to merge them into a single file or keep them in the correct order. I have included them in this post as txt files and I am hoping someone knows how to merge them into a single chapter file that MKVToolNix will recognise and that I can then mux them into my otherwise completed MKV concert file.

    Thanks so much for your help guys and gals, too!

    I have also uploaded a text file with the chapters combined (as best as I could) in simple time format. Perhaps someone knows how to convert this combined file into something MKVToolNix will recognise (Ogg or XML) and allow me to thereby mux it into my concert .mkv file.
    Image Attached Files
    Last edited by Todd Sauve; 19th May 2015 at 07:20.
    Quote Quote  
  2. Originally Posted by Todd Sauve View Post
    What process do I have to follow to get the chapters from the two MKVs to merge in their correct order and then mux into the single combined MKV file?
    What you're doing sounds like it should work. I wonder if Handbrake's chapters are non-standard? If you append the two MKVs you shouldn't need to touch the chapters, but if MKVMergeGUI is getting confused, given you have a single text file containing the correct chapters, you should be able to append the two MKVs, de-select the existing chapter tracks, then under the Global tab add the new chapter file in the chapters section. That should work.

    You can't extract chapters the way you described, but you can extract chapters from MKVs with MKVcleaver or gMKVExtractGUI. When you extract them as a text or ogg chapters file, they should look like this:

    CHAPTER01=00:00:00.000
    CHAPTER01NAME=00:00:00.000
    CHAPTER02=00:05:48.348
    CHAPTER02NAME=00:05:48.348
    CHAPTER03=00:08:58.538
    CHAPTER03NAME=00:08:58.538
    CHAPTER04=00:13:24.846
    CHAPTER04NAME=00:13:24.846
    CHAPTER05=00:15:26.676
    CHAPTER05NAME=00:15:26.676

    The chapter name can be whatever you like. ie:

    CHAPTER01=00:00:00.000
    CHAPTER01NAME=Chapter 1
    CHAPTER02=00:10:23.000
    CHAPTER02NAME=Chapter 2
    CHAPTER03=00:20:36.000
    CHAPTER03NAME=Chapter 3
    CHAPTER04=00:30:58.000
    CHAPTER04NAME=Chapter 4
    CHAPTER05=00:40:03.000
    CHAPTER05NAME=Chapter 5

    The above is a format MKVMergeGUI will understand. It can be a text file, but you need to add it under the Global tab. It shouldn't be too hard to modify your existing chapters file to the above format.
    Last edited by hello_hello; 19th May 2015 at 07:57.
    Quote Quote  
  3. Member Todd Sauve's Avatar
    Join Date
    Mar 2012
    Location
    Calgary, Alberta
    Search Comp PM
    Hi Hello,

    I just tried what you suggested and got the following error message:

    Error: Simple chapter parser: 'CHAPTER08=01:21:18:680' is not a CHAPTERxx=... line.

    So here is the chapter file I just tried to mux into my concert, with the "chapters" checkbox unchecked and the new chapters file added according to your instructions under the Global tab.

    To get my new chapters file I used ChapterXtractor to extract them in the OGG format with a .txt ending. Then I just copied and pasted them end for end, making allowance for the new timings. Something is not working right and I've been up all night trying to make this work. Now I can't even think straight and have to go to bed. I must have messed up the new timing code somewhere, as it says Chapter 8 is the culprit.

    Can you look over all of my files, including the timing info from my first post, and see if you can find out why I'm getting this error message?

    I've done something wrong but am at a loss as to what it is.

    Here is what they look like inside the .txt file:

    CHAPTER01=00:00:00.000
    CHAPTER01NAME=Chapter 1
    CHAPTER02=00:03:29.080
    CHAPTER02NAME=Chapter 2
    CHAPTER03=00:17:34.040
    CHAPTER03NAME=Chapter 3
    CHAPTER04=00:23:09.160
    CHAPTER04NAME=Chapter 4
    CHAPTER05=00:31:23.560
    CHAPTER05NAME=Chapter 5
    CHAPTER06=00:38:34.240
    CHAPTER06NAME=Chapter 6
    CHAPTER07=00:46:39.320
    CHAPTER07NAME=Chapter 7
    CHAPTER08=01:21:18:680
    CHAPTER08NAME=Chapter 8
    CHAPTER09=01:28:18:160
    CHAPTER09NAME=Chapter 9
    CHAPTER10=01:33:07:160
    CHAPTER10NAME=Chapter 10
    CHAPTER11=01:39:09:760
    CHAPTER11NAME=Chapter 11
    CHAPTER12=01:45:46:000
    CHAPTER12NAME=Chapter 12
    CHAPTER13=01:49:40:600
    CHAPTER13NAME=Chapter 13
    CHAPTER14=01:57:46:040
    CHAPTER14NAME=Chapter 14
    CHAPTER15=02:00:18:320
    CHAPTER15NAME=Chapter 15
    CHAPTER16=02:06:47:240
    CHAPTER16NAME=Chapter 16
    CHAPTER17=02:08:44:800
    CHAPTER17NAME=Chapter 17
    CHAPTER18=02:18:36:480
    CHAPTER18NAME=Chapter 18

    Hopefully it is something simple that someone will recognise right away. Chapter 8 is where the two discs change, with chapter 8 being the first chapter on the second disc.

    Thanks so much for your help Hello!
    Image Attached Files
    Last edited by Todd Sauve; 19th May 2015 at 08:54.
    Quote Quote  
  4. According to the chapters file I just extracted, the format is

    Hours
    Colon
    Minutes
    Colon
    Seconds
    Full stop
    Milliseconds

    From chapter eight on, you've used a colon instead of a full stop. I assume that's the problem.

    Don't feel bad. I sometimes get errors from Avisynth and it usually tells you where to look in the script so I look and I look and I look..... and it's usually something simple like that.

    By the way, I think you're missing a chapter. If the first chapter from the second file is at the beginning, it's effectively at the end of the first half, and the first half duration is 59:07.040 (according to the info in the text file), so there should be a chapter at 00:59:07:040. The next one should be 22:12.040 on from there, which I make out to be at 01:21:19.080...... 59 minutes + 22 minutes = 1 hour 21 minutes with another 19 seconds and 80 milliseconds..... but thinking in minutes and seconds hurts my brain so don't take that as gospel......
    I think you timed the chapters for the second half according to the last chapter in the first file, the one that was skipped, but it's not quite at the end of the first half, apparently. The timing difference would only be about 1 second anyway. Either way though, you're probably missing a chapter.
    Last edited by hello_hello; 19th May 2015 at 09:32.
    Quote Quote  
  5. Member Todd Sauve's Avatar
    Join Date
    Mar 2012
    Location
    Calgary, Alberta
    Search Comp PM
    OK, thanks muchly Hello! I'm so glad your fresh set of eyes noticed my mistakes here! Once I've got a few more hours of sleep under my belt I'll make these changes and see if they work. I'm sure they will!

    PS I didn't use a colon, the ChapterXtractor program put them in there instead of the simple period. All I did was copy and paste, so there is a bug in that program, too! Oh the joys of finding bugs in apps!
    Last edited by Todd Sauve; 19th May 2015 at 11:02.
    Quote Quote  
  6. Maybe I should have mentioned it before, but if you happen to have MeGUI it has a Chapter Creator under the Tools menu that extracts chapters from DVDs in the correct format for MKVMergeGUI to play with. I've never used it for MKVs before, but it appears it'll also extract chapters from them. There's possibly a standalone version but I've not looked.

    You'll still need to adjust the timing for the second half to create one large chapter file. I tried appending two MKVs with chapters and the result was the same, the chapters didn't append properly. MKVMergeGUI does indicate the chapters aren't being appended, because there's no double plus sign next to the chapters track as there are for the rest of the tracks. That seems odd to me. MKVMergeGUI can append MKVs with subtitles without a problem (I'm pretty sure) so I'm not sure why it doesn't append chapters. Maybe I'd just assumed it could, but I tried a few older versions and none of them appended the chapters.

    Anyway, chances are the chapters in the individual MKVs are fine (the ones created by Handbrake) and if you extracted them with MKVcleaver or gMKVExtractGUI they'd at least extract in an MKVMergeGUI friendly format.
    Quote Quote  
  7. Member Todd Sauve's Avatar
    Join Date
    Mar 2012
    Location
    Calgary, Alberta
    Search Comp PM
    OK, I fixed the problems you noticed and now everything muxed together properly. Thanks again!

    It is very strange that we can mux everything nicely by using the Append button except for the chapters. Like you, I wonder why?
    Last edited by Todd Sauve; 19th May 2015 at 22:24.
    Quote Quote  
  8. The penny dropped just as I hit the submit button on this post so I wrote another one. I think the explanation for the lack of chapter appending might be there, but there's still a bit of useful info in this one. If you check my theory and discover anything of interest, please let me know.

    I'll was going to ask about the chapters problem in the MKVToolnix thread at doom9 but maybe there's no need now.

    I looked at MeGUI's chapter creator yesterday thinking it might do some clever editing, but not so much, and unfortunately it didn't occur to me to remember MKVMergeGUI's chapter editor until I started writing this post as I've never used it. I just had a look at it and it can adjust the timecodes of a chapters file by a specific amount, which would have been handy yesterday for adjusting them all together.

    It'll only save chapters file in XML format which contain a lot more information. If you load a text chapter file and save it as XML it goes from looking like the chapters in post 2 to the ones below. Chapters can have sub chapters, they can be enabled and disabled individually (a player is supposed to skip a disabled chapter), the end of a chapter doesn't have to be where the next one begins (I don't think) and you can create ordered chapters where chapters can be in different files completely (as long as those MKVs are linked, I assume). All chapter features I've never used, but I thought maybe MKVMergeGUI would append XML chapters correctly, however no...... still no luck.

    There's probably a reason it won't append them and I strongly suspect it's related to ordered chapters in some way.

    <?xml version="1.0"?>
    <!-- <!DOCTYPE Chapters SYSTEM "matroskachapters.dtd"> -->
    <Chapters>
    <EditionEntry>
    <EditionFlagHidden>0</EditionFlagHidden>
    <EditionFlagDefault>0</EditionFlagDefault>
    <ChapterAtom>
    <ChapterUID>16166103512909996176</ChapterUID>
    <ChapterFlagHidden>0</ChapterFlagHidden>
    <ChapterFlagEnabled>1</ChapterFlagEnabled>
    <ChapterDisplay>
    <ChapterString>Chapter 1</ChapterString>
    <ChapterLanguage>und</ChapterLanguage>
    </ChapterDisplay>
    <ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
    </ChapterAtom>
    <ChapterAtom>
    <ChapterUID>15440135639376645051</ChapterUID>
    <ChapterFlagHidden>0</ChapterFlagHidden>
    <ChapterDisplay>
    <ChapterString>Chapter 2</ChapterString>
    <ChapterLanguage>und</ChapterLanguage>
    </ChapterDisplay>
    <ChapterTimeStart>00:10:23.000000000</ChapterTimeStart>
    <ChapterFlagEnabled>1</ChapterFlagEnabled>
    </ChapterAtom>
    <ChapterAtom>
    <ChapterUID>12022452575561360533</ChapterUID>
    <ChapterFlagHidden>0</ChapterFlagHidden>
    <ChapterFlagEnabled>1</ChapterFlagEnabled>
    <ChapterDisplay>
    <ChapterString>Chapter 3</ChapterString>
    <ChapterLanguage>und</ChapterLanguage>
    </ChapterDisplay>
    <ChapterTimeStart>00:20:36.000000000</ChapterTimeStart>
    </ChapterAtom>
    <ChapterAtom>
    <ChapterUID>4280286897054117781</ChapterUID>
    <ChapterFlagHidden>0</ChapterFlagHidden>
    <ChapterFlagEnabled>1</ChapterFlagEnabled>
    <ChapterDisplay>
    <ChapterString>Chapter 4</ChapterString>
    <ChapterLanguage>und</ChapterLanguage>
    </ChapterDisplay>
    <ChapterTimeStart>00:30:58.000000000</ChapterTimeStart>
    </ChapterAtom>
    <ChapterAtom>
    <ChapterUID>5889868292164034692</ChapterUID>
    <ChapterFlagHidden>0</ChapterFlagHidden>
    <ChapterDisplay>
    <ChapterString>Chapter 5</ChapterString>
    <ChapterLanguage>und</ChapterLanguage>
    </ChapterDisplay>
    <ChapterTimeStart>00:40:03.000000000</ChapterTimeStart>
    <ChapterFlagEnabled>1</ChapterFlagEnabled>
    </ChapterAtom>
    <EditionUID>11117770218970185396</EditionUID>
    </EditionEntry>
    </Chapters>
    Last edited by hello_hello; 20th May 2015 at 03:28.
    Quote Quote  
  9. I think the penny dropped just as I submitted my last post.

    I'm pretty sure it's do so with the chapters having ChapterUID's. For chapters to "append' correctly those ID's need to be unique and therefore my testing method yesterday was flawed. I took a file with chapters, copied it, and then appended the copy to the original. I'm pretty sure that didn't work as expected as the chapters in each file would have had the same ChapterUID.

    So I made a copy of the MKV first this time, remuxed the original and the copy while adding the same text chapter file to each one (MKVMerge should give each chapter a unique ID when muxing if they don't have one), and then I tried appending the remuxed MKVs. Bingo! The appended file had appended chapters. They didn't show as "appending" in the track list along with the rest of the files, but they were effectively appended the same way.

    Which begs the question...... why wasn't it working that way for you? I've no idea except that it must relate to the ChapterUID, which is supposed to be unique for each chapter..... hence the name...... and maybe Handbrake is creating MKVs with chapters that don't have unique chapter IDs for some reason. You could try switching to MKVMerge's chapter editor tab, loading one of the MKV's in question via the chapter editor menu and clicking on one of the chapters being shown. Do they appear to have ChapterUIDs? If so, are they actually unique?
    Last edited by hello_hello; 20th May 2015 at 03:40.
    Quote Quote  
  10. Member
    Join Date
    Mar 2009
    Location
    Canada
    Search Comp PM
    i know this is a topic that is searched very often, and because this thread is near the top of Google results, I wanted to post even though this thread is old.


    If you have two files you want to append, the first with chapters 1-15 and the second with chapters 1-12, you need to put the second file into the Chapter Editor in MKVToolNix and rename the chapters so they are 16-27. Then save.

    Now when you append two files, the chapters will combine in the new file.
    Quote Quote  
  11. Originally Posted by rmeyers View Post
    If you have two files you want to append, the first with chapters 1-15 and the second with chapters 1-12, you need to put the second file into the Chapter Editor in MKVToolNix and rename the chapters so they are 16-27. Then save.
    The chapter names have nothing to do with it. Only if chapter UIDs are identical appending doesn't work.

    But for HandBrake files this isn't necessary anymore. Mkvtoolnix detects if the files were created by HandBrake and writes new chapter UIDs automatically.
    Quote Quote  
  12. Member
    Join Date
    Mar 2009
    Location
    Canada
    Search Comp PM
    Originally Posted by sneaker View Post
    Originally Posted by rmeyers View Post
    If you have two files you want to append, the first with chapters 1-15 and the second with chapters 1-12, you need to put the second file into the Chapter Editor in MKVToolNix and rename the chapters so they are 16-27. Then save.
    The chapter names have nothing to do with it. Only if chapter UIDs are identical appending doesn't work.

    But for HandBrake files this isn't necessary anymore. Mkvtoolnix detects if the files were created by HandBrake and writes new chapter UIDs automatically.

    Incorrect. They definitely do. You can try to append two files that have unique UIDs and the same chapter names "Chapter 01 to Chapter 10" and report back when you only get 10 chapters in your appended file, not 20.
    Quote Quote  
  13. I have tested this. Changing chapter names does nothing. Only changing chapter UIDs helps, then it will even append with chapters that have the same names.
    Quote Quote  



Similar Threads