Do you have movie subtitles in the form of IDX and SUB and you want to include these subtitles into your MKV movie container? Here is the solution on how to achieve that on macOS with the help open-source tools. Of course, it can also be done on Windows/Linux because the required software is also available for these platfroms. However, as I don’t use these platforms you will have to read the documentation about how to install the software on your platfrom. Afterwards the commands should be the same.
NOTE: IDX/SUB subtitle files most often originate from DVD rips. Sometimes they are also referred as VobSub subtitles. These subtitles are normally saved as a series of transparent images containing only the text (binary file with the ending .SUB). The transparent images are laid over the movie. The instructions for the sequence and timing of the image display within the movie are stored in an index file (text file with the ending .IDX).
What you will need:
- a Matroska movie file
- corresponding subtitle files, 2 per language (.IDX and .SUB)
- the open-source terminal software ‘MKVtoolNIX’
The easiest way to install ‘MKVtooNIX’ is ‘Homebrew’. If you don’t have ‘Homebrew’ already, you will have to install it before installing ‘MKVtoolNIX’. Open your Terminal and copy & paste the following two lines:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install mkvtoolnix
For illustration purposes let’s assume that you have one MKV file for which you want to add two subtitle language (e.g. English and German). You arepreparing all your files on the Desktop of your macOS as following:
- MKV file: input.mkv
- English subtitles: eng.idx and eng.sub
- German subtitles: ger.idx and ger.sub
Again, open your Terminal and copy & paste the following two commands:
mkvmerge -o output.mkv input.mkv eng.idx ger.idx
The first command will set the focus of your Terminal to the Desktop folder of your current user. The second command will create a new MKV file with the name output.mkv by merging the original MKV file with the two subtitle files. Note that the files with the ending .sub are not mentioned in the command. They need to have the same naming pattern as their corresponding .idx files.
Sometimes your subtitle files will contain a misformatted or wrong language name. In order to have your video player to display the appropriate language name you can force the tool to overwrite the existing language naming.
mkvmerge -o output.mkv input.mkv --language 0:eng eng.idx --language 0:ger ger.idx
mkvmerge --no-subtitles -o output.mkv input.mkv --language 0:eng eng.idx --language 0:ger ger.idx
The first command displays a list of all ISO639-2 language codes. Choose the appropriate ISO code for your language and put it together with the parameter ‘–language 0:<ISO code>’ in front of each IDX input file (see second command).
If you have an input movie file that already contains subtitle streams, but you want to remove these subtitles and add your own VobSub subtitles, then you can add the parameter ‘–no-subtitles’ after the the command ‘mkvmerge’ (see third command). In this case the subtitle streams from the input.mkv file will not be transferred to the ouput.mkv file.