Ripping physical media with MakeMKV and MKVMerge
I love physical media. I like the freedom of buying something that nobody can take away, something envied by my Netflix-subscribing friends who have been unlucky enough to be halfway through watching a TV series when Netflix’s license to distribute it ran out, and never got to see the last episode.
I do, however, dislike getting up to change discs, which is why I generally buy my content on physical media and then rip it to a NAS, from where I can watch it from any of the four Kodi boxes in my house. I tend to use the excellent MakeMKV to rip 1080p+ formats such as HD-DVD and Blu-Ray, because it’s a simple case of put the disc in, it makes a perfect copy of the content on hard drive, done, no bells or whistles. But there are times I want to do a little bit more than MakeMKV can do, and this is where mkvmerge comes in.
There are two main tasks I generally need to do. Firstly, I need to remove certain streams, such as subtitles or audio tracks for languages I don’t understand or want. For example, English-language anime will generally come with two audio tracks, one original Japanese, one with an English dub, and two subtitle tracks, one a transcript of the dub for the hard-of-hearing and the other a literal translation of the Japanese for those who want to watch their foreign language content subtitled. I usually just want to keep the literal translation and - depending on the quality of the dub - sometimes remove the English language audio as well.
Secondly, a lot of Blu-Rays containing a whole TV series will have the entire series as a single video stream, split into chapters so you can jump to a specific episode. I don’t want this, I want one episode per file.
With ffprobe and mkvmerge, I can do this all in just two commands.
ffprobe -i [filename]
This command will list the contents of the ripped MKV file. Part of the information will contain the list of tracks/streams (video, audio and subtitles) contained within. Let’s say Stream 0#0 is the video, 0#1 is the English audio, 0#2 is the Japanese audio, 0#3 is the subtitles for the hard-of-hearing, and 0#4 is the literal translation. Also, there are six episodes, each consisting of 5 chapters each, for a total of 30 chapters. To split the video into six individual files, containing just the Japanese track and the literal translation…
mkvmerge -o [output filename] --audio-tracks 2 --subtitle-tracks 4 --split chapters:6,11,16,21,26 [filename]
If we want to include the English dub as well we can do so with
mkvmerge -o [output filename] --audio-tracks 1,2 --subtitle-tracks 4 --split chapters:6,11,16,21,26 [filename]
although as we’ve now included all the available audio tracks we can simply omit the whole
--audio-tracks argument because mkvmerge defaults to processing all tracks. If you don’t want to include any audio, you need to use
--no-audio, likewise if you want to exclude the subtitles, use
--split argument contains the chapters before which we want to split the video. So in this instance, chapter 6 is the first chapter of the second episode, 11 is the first chapter of the second, and so on. mkvmerge will split and name the files automatically. The
-o argument dictates the base filename, but this command will generate six files named
Of course I’m aware MakeMKV will exclude audio or subtitle tracks at the point of ripping - this is fine if you’re watching a movie that has many audio tracks in clearly defined languages, but in the case above the two English subtitle tracks will just be labelled ‘English’ and you need to watch a bit of the file in VLC Player in order to determine which one you actually want. Also, director commentaries are not always clearly labelled, so it’s often prudent to just rip the entire disc and then work out where to go from there. Also, it’s nice to be able to add and remove streams from video files without having to re-rip a disc.