Merging mkv file chapters into one chapter












1














How would you merge chapters in mkv files into one chapter? I've only found threads about adding, removing and splitting chapters. I'm looking for a command line tool. Can ffmpeg be used for this?










share|improve this question



























    1














    How would you merge chapters in mkv files into one chapter? I've only found threads about adding, removing and splitting chapters. I'm looking for a command line tool. Can ffmpeg be used for this?










    share|improve this question

























      1












      1








      1







      How would you merge chapters in mkv files into one chapter? I've only found threads about adding, removing and splitting chapters. I'm looking for a command line tool. Can ffmpeg be used for this?










      share|improve this question













      How would you merge chapters in mkv files into one chapter? I've only found threads about adding, removing and splitting chapters. I'm looking for a command line tool. Can ffmpeg be used for this?







      ffmpeg mkv






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 9 at 21:25









      Mikey

      284




      284






















          1 Answer
          1






          active

          oldest

          votes


















          2














          In most cases ffmeg only can help.



          Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):



          # this is a comment
          file '/path/to/file1.mkv'
          file '/path/to/file2.mkv'
          file '/path/to/file3.mkv'


          Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:



          ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv


          The -safe 0 above is not required if the paths are relative.
          The -c copy try concat files without re-encoding. Try remove this params if something will wrong. I mean mkv is a just container can included inside any codecs like h.264 (MPEG-4 AVC), MPEG-2, VC-1, MPEG-2, mpeg-4 / Xvid / DivX.. It need to know which one encoderdecoder codec(s) installed or not with your ffmpeg. Need know exactly or just try. But this is another question. Let's assume that your ffmpeg install fully support your current mkv's codecs.



          Source: https://trac.ffmpeg.org/wiki/Concatenate






          share|improve this answer























          • Perhaps I wasen't clear enough. I'm looking for a way to merge chapters inside let's say name_of_movie.mkv into one chapter. I dont want to merge several movies together. I found an option in handbrake, which does exactly what I want but I'm still looking for a command line alternative, which could be used in a script. I find it a bit odd if you cannot do this on the command line. I'm using linux btw. PS4 is not able to play movies, which are split into chapters. Sorry for the missleading question and the use of loose definiton. Working with media files is a new territory for me.
            – Mikey
            Dec 10 at 0:26










          • Can you explain without "chapter" term, just using files terms? And what you mean when told "merge chapters inside"? PS4 can play only specific codecs (for example h.264). File extension like mkv don't have a relation to codecs.
            – mature
            Dec 10 at 8:24










          • It's possible to placess markers (starting points) at different points in the video so you can easily jump to them using the keyboard. Let's say I have a 1 h long video presentation and at 25.18 I bring up something interesting. I can place a marker at 25.18 and when I press some key on the keyboard I will get to 25.18. They are called chapter markers but people seem to refer to them as chapters. Now I have mkv movies, which have up to 4 chapter markers. I did a comparison between the mkv movies that worked on Ps4 ad the one's that didn't using handbrake and I noticed that the one's
            – Mikey
            Dec 10 at 12:20












          • that didn't work had 4 chapters markers. The one's that worked had only one chapter marker. I would like one chapter marker instead of 4.
            – Mikey
            Dec 10 at 12:23






          • 1




            You mean metadata markers: ffmpeg.org/ffmpeg-formats.html#Metadata-1
            – mature
            Dec 10 at 12:26











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1099648%2fmerging-mkv-file-chapters-into-one-chapter%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          In most cases ffmeg only can help.



          Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):



          # this is a comment
          file '/path/to/file1.mkv'
          file '/path/to/file2.mkv'
          file '/path/to/file3.mkv'


          Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:



          ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv


          The -safe 0 above is not required if the paths are relative.
          The -c copy try concat files without re-encoding. Try remove this params if something will wrong. I mean mkv is a just container can included inside any codecs like h.264 (MPEG-4 AVC), MPEG-2, VC-1, MPEG-2, mpeg-4 / Xvid / DivX.. It need to know which one encoderdecoder codec(s) installed or not with your ffmpeg. Need know exactly or just try. But this is another question. Let's assume that your ffmpeg install fully support your current mkv's codecs.



          Source: https://trac.ffmpeg.org/wiki/Concatenate






          share|improve this answer























          • Perhaps I wasen't clear enough. I'm looking for a way to merge chapters inside let's say name_of_movie.mkv into one chapter. I dont want to merge several movies together. I found an option in handbrake, which does exactly what I want but I'm still looking for a command line alternative, which could be used in a script. I find it a bit odd if you cannot do this on the command line. I'm using linux btw. PS4 is not able to play movies, which are split into chapters. Sorry for the missleading question and the use of loose definiton. Working with media files is a new territory for me.
            – Mikey
            Dec 10 at 0:26










          • Can you explain without "chapter" term, just using files terms? And what you mean when told "merge chapters inside"? PS4 can play only specific codecs (for example h.264). File extension like mkv don't have a relation to codecs.
            – mature
            Dec 10 at 8:24










          • It's possible to placess markers (starting points) at different points in the video so you can easily jump to them using the keyboard. Let's say I have a 1 h long video presentation and at 25.18 I bring up something interesting. I can place a marker at 25.18 and when I press some key on the keyboard I will get to 25.18. They are called chapter markers but people seem to refer to them as chapters. Now I have mkv movies, which have up to 4 chapter markers. I did a comparison between the mkv movies that worked on Ps4 ad the one's that didn't using handbrake and I noticed that the one's
            – Mikey
            Dec 10 at 12:20












          • that didn't work had 4 chapters markers. The one's that worked had only one chapter marker. I would like one chapter marker instead of 4.
            – Mikey
            Dec 10 at 12:23






          • 1




            You mean metadata markers: ffmpeg.org/ffmpeg-formats.html#Metadata-1
            – mature
            Dec 10 at 12:26
















          2














          In most cases ffmeg only can help.



          Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):



          # this is a comment
          file '/path/to/file1.mkv'
          file '/path/to/file2.mkv'
          file '/path/to/file3.mkv'


          Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:



          ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv


          The -safe 0 above is not required if the paths are relative.
          The -c copy try concat files without re-encoding. Try remove this params if something will wrong. I mean mkv is a just container can included inside any codecs like h.264 (MPEG-4 AVC), MPEG-2, VC-1, MPEG-2, mpeg-4 / Xvid / DivX.. It need to know which one encoderdecoder codec(s) installed or not with your ffmpeg. Need know exactly or just try. But this is another question. Let's assume that your ffmpeg install fully support your current mkv's codecs.



          Source: https://trac.ffmpeg.org/wiki/Concatenate






          share|improve this answer























          • Perhaps I wasen't clear enough. I'm looking for a way to merge chapters inside let's say name_of_movie.mkv into one chapter. I dont want to merge several movies together. I found an option in handbrake, which does exactly what I want but I'm still looking for a command line alternative, which could be used in a script. I find it a bit odd if you cannot do this on the command line. I'm using linux btw. PS4 is not able to play movies, which are split into chapters. Sorry for the missleading question and the use of loose definiton. Working with media files is a new territory for me.
            – Mikey
            Dec 10 at 0:26










          • Can you explain without "chapter" term, just using files terms? And what you mean when told "merge chapters inside"? PS4 can play only specific codecs (for example h.264). File extension like mkv don't have a relation to codecs.
            – mature
            Dec 10 at 8:24










          • It's possible to placess markers (starting points) at different points in the video so you can easily jump to them using the keyboard. Let's say I have a 1 h long video presentation and at 25.18 I bring up something interesting. I can place a marker at 25.18 and when I press some key on the keyboard I will get to 25.18. They are called chapter markers but people seem to refer to them as chapters. Now I have mkv movies, which have up to 4 chapter markers. I did a comparison between the mkv movies that worked on Ps4 ad the one's that didn't using handbrake and I noticed that the one's
            – Mikey
            Dec 10 at 12:20












          • that didn't work had 4 chapters markers. The one's that worked had only one chapter marker. I would like one chapter marker instead of 4.
            – Mikey
            Dec 10 at 12:23






          • 1




            You mean metadata markers: ffmpeg.org/ffmpeg-formats.html#Metadata-1
            – mature
            Dec 10 at 12:26














          2












          2








          2






          In most cases ffmeg only can help.



          Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):



          # this is a comment
          file '/path/to/file1.mkv'
          file '/path/to/file2.mkv'
          file '/path/to/file3.mkv'


          Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:



          ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv


          The -safe 0 above is not required if the paths are relative.
          The -c copy try concat files without re-encoding. Try remove this params if something will wrong. I mean mkv is a just container can included inside any codecs like h.264 (MPEG-4 AVC), MPEG-2, VC-1, MPEG-2, mpeg-4 / Xvid / DivX.. It need to know which one encoderdecoder codec(s) installed or not with your ffmpeg. Need know exactly or just try. But this is another question. Let's assume that your ffmpeg install fully support your current mkv's codecs.



          Source: https://trac.ffmpeg.org/wiki/Concatenate






          share|improve this answer














          In most cases ffmeg only can help.



          Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):



          # this is a comment
          file '/path/to/file1.mkv'
          file '/path/to/file2.mkv'
          file '/path/to/file3.mkv'


          Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:



          ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv


          The -safe 0 above is not required if the paths are relative.
          The -c copy try concat files without re-encoding. Try remove this params if something will wrong. I mean mkv is a just container can included inside any codecs like h.264 (MPEG-4 AVC), MPEG-2, VC-1, MPEG-2, mpeg-4 / Xvid / DivX.. It need to know which one encoderdecoder codec(s) installed or not with your ffmpeg. Need know exactly or just try. But this is another question. Let's assume that your ffmpeg install fully support your current mkv's codecs.



          Source: https://trac.ffmpeg.org/wiki/Concatenate







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 9 at 23:11

























          answered Dec 9 at 22:38









          mature

          1,491422




          1,491422












          • Perhaps I wasen't clear enough. I'm looking for a way to merge chapters inside let's say name_of_movie.mkv into one chapter. I dont want to merge several movies together. I found an option in handbrake, which does exactly what I want but I'm still looking for a command line alternative, which could be used in a script. I find it a bit odd if you cannot do this on the command line. I'm using linux btw. PS4 is not able to play movies, which are split into chapters. Sorry for the missleading question and the use of loose definiton. Working with media files is a new territory for me.
            – Mikey
            Dec 10 at 0:26










          • Can you explain without "chapter" term, just using files terms? And what you mean when told "merge chapters inside"? PS4 can play only specific codecs (for example h.264). File extension like mkv don't have a relation to codecs.
            – mature
            Dec 10 at 8:24










          • It's possible to placess markers (starting points) at different points in the video so you can easily jump to them using the keyboard. Let's say I have a 1 h long video presentation and at 25.18 I bring up something interesting. I can place a marker at 25.18 and when I press some key on the keyboard I will get to 25.18. They are called chapter markers but people seem to refer to them as chapters. Now I have mkv movies, which have up to 4 chapter markers. I did a comparison between the mkv movies that worked on Ps4 ad the one's that didn't using handbrake and I noticed that the one's
            – Mikey
            Dec 10 at 12:20












          • that didn't work had 4 chapters markers. The one's that worked had only one chapter marker. I would like one chapter marker instead of 4.
            – Mikey
            Dec 10 at 12:23






          • 1




            You mean metadata markers: ffmpeg.org/ffmpeg-formats.html#Metadata-1
            – mature
            Dec 10 at 12:26


















          • Perhaps I wasen't clear enough. I'm looking for a way to merge chapters inside let's say name_of_movie.mkv into one chapter. I dont want to merge several movies together. I found an option in handbrake, which does exactly what I want but I'm still looking for a command line alternative, which could be used in a script. I find it a bit odd if you cannot do this on the command line. I'm using linux btw. PS4 is not able to play movies, which are split into chapters. Sorry for the missleading question and the use of loose definiton. Working with media files is a new territory for me.
            – Mikey
            Dec 10 at 0:26










          • Can you explain without "chapter" term, just using files terms? And what you mean when told "merge chapters inside"? PS4 can play only specific codecs (for example h.264). File extension like mkv don't have a relation to codecs.
            – mature
            Dec 10 at 8:24










          • It's possible to placess markers (starting points) at different points in the video so you can easily jump to them using the keyboard. Let's say I have a 1 h long video presentation and at 25.18 I bring up something interesting. I can place a marker at 25.18 and when I press some key on the keyboard I will get to 25.18. They are called chapter markers but people seem to refer to them as chapters. Now I have mkv movies, which have up to 4 chapter markers. I did a comparison between the mkv movies that worked on Ps4 ad the one's that didn't using handbrake and I noticed that the one's
            – Mikey
            Dec 10 at 12:20












          • that didn't work had 4 chapters markers. The one's that worked had only one chapter marker. I would like one chapter marker instead of 4.
            – Mikey
            Dec 10 at 12:23






          • 1




            You mean metadata markers: ffmpeg.org/ffmpeg-formats.html#Metadata-1
            – mature
            Dec 10 at 12:26
















          Perhaps I wasen't clear enough. I'm looking for a way to merge chapters inside let's say name_of_movie.mkv into one chapter. I dont want to merge several movies together. I found an option in handbrake, which does exactly what I want but I'm still looking for a command line alternative, which could be used in a script. I find it a bit odd if you cannot do this on the command line. I'm using linux btw. PS4 is not able to play movies, which are split into chapters. Sorry for the missleading question and the use of loose definiton. Working with media files is a new territory for me.
          – Mikey
          Dec 10 at 0:26




          Perhaps I wasen't clear enough. I'm looking for a way to merge chapters inside let's say name_of_movie.mkv into one chapter. I dont want to merge several movies together. I found an option in handbrake, which does exactly what I want but I'm still looking for a command line alternative, which could be used in a script. I find it a bit odd if you cannot do this on the command line. I'm using linux btw. PS4 is not able to play movies, which are split into chapters. Sorry for the missleading question and the use of loose definiton. Working with media files is a new territory for me.
          – Mikey
          Dec 10 at 0:26












          Can you explain without "chapter" term, just using files terms? And what you mean when told "merge chapters inside"? PS4 can play only specific codecs (for example h.264). File extension like mkv don't have a relation to codecs.
          – mature
          Dec 10 at 8:24




          Can you explain without "chapter" term, just using files terms? And what you mean when told "merge chapters inside"? PS4 can play only specific codecs (for example h.264). File extension like mkv don't have a relation to codecs.
          – mature
          Dec 10 at 8:24












          It's possible to placess markers (starting points) at different points in the video so you can easily jump to them using the keyboard. Let's say I have a 1 h long video presentation and at 25.18 I bring up something interesting. I can place a marker at 25.18 and when I press some key on the keyboard I will get to 25.18. They are called chapter markers but people seem to refer to them as chapters. Now I have mkv movies, which have up to 4 chapter markers. I did a comparison between the mkv movies that worked on Ps4 ad the one's that didn't using handbrake and I noticed that the one's
          – Mikey
          Dec 10 at 12:20






          It's possible to placess markers (starting points) at different points in the video so you can easily jump to them using the keyboard. Let's say I have a 1 h long video presentation and at 25.18 I bring up something interesting. I can place a marker at 25.18 and when I press some key on the keyboard I will get to 25.18. They are called chapter markers but people seem to refer to them as chapters. Now I have mkv movies, which have up to 4 chapter markers. I did a comparison between the mkv movies that worked on Ps4 ad the one's that didn't using handbrake and I noticed that the one's
          – Mikey
          Dec 10 at 12:20














          that didn't work had 4 chapters markers. The one's that worked had only one chapter marker. I would like one chapter marker instead of 4.
          – Mikey
          Dec 10 at 12:23




          that didn't work had 4 chapters markers. The one's that worked had only one chapter marker. I would like one chapter marker instead of 4.
          – Mikey
          Dec 10 at 12:23




          1




          1




          You mean metadata markers: ffmpeg.org/ffmpeg-formats.html#Metadata-1
          – mature
          Dec 10 at 12:26




          You mean metadata markers: ffmpeg.org/ffmpeg-formats.html#Metadata-1
          – mature
          Dec 10 at 12:26


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1099648%2fmerging-mkv-file-chapters-into-one-chapter%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

           ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕