How to join two MKV files in Ubuntu

Categories:  Linux
Labels:  terminal

I have an opera that I’m ripping to my computer in MKV format with Handbrake. This opera is on two discs. Is there a way to join the resulting MKV’s together? They will have the same bitrate, resolution…

If I do this, can I keep chapters from both MKV files organized? And, since I have subtitles in the file (not burnt in), will they still stay intact?


The Recommended way is to use mkvtoolnix

$ sudo apt-get install mkvtoolnix mkvtoolnix-gui
  • Start mmg (graphical user interface for mkvmerge)
  • “Add” the first file
  • “Append” the second one, third, fourth, …
  • Set output name in the textbox at the bottom
  • “Start muxing”

Subtitles are preserved and properly concatenated, so are audio and video. Chapters can be edited in the resulting file with mmg.

This procedure creates a properly muxed file.
Any problems should be mentioned in the “log”-window in mmg.
You can even set and name audio and subtitle tracks with the correct language codes and Annotations like “Forced” or “Directors Commentary”.

If you plan to do this repeatedly on different files you better use the command line version mkvmerge mkvmerge --help

$ mkvmerge -o output.mkv input1.mkv +input2.mkv

This from command line instruction works fine in debian-ubuntu specially. The GUI not goes as fine as the bash line command prompt instruction.



Related Posts: