It’s common to find video material (wink wink) with a large list of embeded subtitle and / or audio tracks, which on occasion are a pain in the behind for my TV set. To help it work better with these, I remove the audio or subtitle tracks that are not required. And for automate the process (for example, if there are a considerable amount of, ejem, chapters), I use some variants of the following command:
$ mkvmerge --output ${OUTPUT_FILE}.mkv --audio-tracks 1,2 --subtitle-tracks 9,14 --language 0:und \
--aspect-ratio 0:16/9 --default-duration 0:24000/1001p --language 1:en --language 2:es \
--sub-charset 9:UTF-8 --language 9:en --sub-charset 14:UTF-8 --language 14:es \
'(' ${INPUT_FILE} ')' --track-order 0:0,0:1,0:2,0:9,0:14
And a quick explanationo of the options:
--output
: the name of the output file.--audio-tracks
: the list of audio tracks to include from the input file, according to the mkvmerge
numbering (starts in 0).--subtitle-tracks
: the list of subtitle tracks to include from the input file.--language
: metadata about a given track to indicate the player in what language the selected track is.--aspect-ratio
: I use it for video tracks; indicates the geometry of the picture, which will be used by the player to show the video in that way.--default-duration
: for video tracks, it indicates the frame rate: how many frames per second is the video encoded in.--track-order
: to indicate mkvmerge
in what order the selected tracks will be put together in the output file. The parameters have to be the selected video, audio and subtitle tracks used previously in the same command. Also, this supports the use of multiple input files.By the way, this command was built with the help of the mkvtoolnix-gui
tool.