1

ATTENTION:

THIS QUESTION IS ABOUT DISABLING--NOT REMOVING SUBTITLE TRACKS FROM MKV FILES FROM THE COMMAND LINE. PERIOD.

It IS NOT about REMOVING subtitles by REMUXING with mkvmerge or any other tool. There are literally thousands of threads about removal by remuxing. That's precisely why I started this thread about DISABLING NOT REMOVING subtiles. I could not find a single thread about that.

It is NOT about GLOBALLY DISABLING subtitles in any PLAYER. That is obviously trivial and doesn't need any explanation. I don't need/want to do that and, if I did, I obviously wouldn't have taken the time to research the topic at hand and publish my findings in this thread.

I shouldn't have to add this disclaimer but there have been a number of, in most cases demeaning, 'answers' that reveal a distinct misunderstanding of the OP, suggesting irrelevant 'solutions', and/or criticizing this hack as being 'O-h-h-h-so-difficult' if you want to re-enable the subtitle track at a later date. As I pointed out numerous times, anyone who can understand my answer and who knows how to use the command line will find this task trivial. Those who don't SHOULD NOT ATTEMPT this hack.

The answer has already been given as this is the entire point of this thread. So any new answers are either superfluous or, in SOME cases, irrelevant. I will no longer respond to irrelevant 'answers' or comments or demeaning remarks by users who, judging by their reputations, should know better. Any such abuse will be flagged accordingly.

I welcome any CONSTRUCTIVE suggestions that ADHERE TO THE TOPIC, in a COMMENT, but any 'answers' or negative comments will be unanswered and flagged as inappropriate.

Now that THAT is out of the way, let us begin…

I couldn't find out how to do this anywhere so I thought I'd share this hack with others who, like me, want to DISABLE, NOT REMOVE, subtitles in MKV files.

There are times when you don't want the subtitles that are embedded in a file and you don't want to have to disable subtitles every time you play such a file or globally disable subtitles in every player you happen to have. Or you may want to automatically use a subtitle (srt) file that is preferable.

Sure, you can completely REMOVE subtitles with mkvmerge:

mkvmerge --no-subtitles "inputfile.mkv" -o "outputfile.mkv"

But this is heavy-handed and a real pain if you have a bunch of multi-GB files. It takes lots of time and disk space to de- and re-mux every file. So I turned to mkvpropedit which edits the properties of the subtitle track header in milliseconds. Note that this tool is installed when you install MKVToolNix. Unfortunately, it is not at all obvious how to use this wonderful tool for the task at hand. Here's an example of the properties of a subtitle track as given by mkvinfo:

| + A track
|  + Track number: 4 (track ID for mkvmerge & mkvextract: 3)
|  + Track UID: 11363869179551629452
|  + Track type: subtitles
|  + Default flag: 0
|  + Lacing flag: 0
|  + Codec ID: S_TEXT/UTF8
|  + Name: CC

Despite the default flag setting 0 (false), the subtitle track is still active by default in players. I later read in the mkvmerge documentation "If no track is set to be the default track then mkvmerge will promote the first track of each type that it finds to be the default track. This is consistent with the behavior of various media players." I'm not sure if this means that it sets the default flag to 1 or somehow otherwise arranges for the track to be the default, but it seems maybe the latter.

I tried adding the track enabled property set to false but it didn't work.

mkvpropedit --edit track:4 --set flag-enabled=0 "inputfile.mkv"

| + A track
|  + Track number: 4 (track ID for mkvmerge & mkvextract: 3)
|  + Track UID: 11363869179551629452
|  + Track type: subtitles
|  + Default flag: 0
|  + Lacing flag: 0
|  + Codec ID: S_TEXT/UTF8
|  + Name: CC
|  + Enabled: 0
  • 3
    You'd be (we would all be) better served if you split this into a separate question and answer. Also, nice trick but it might be better to just prefix the codec name with # or ! (eg) to disable it but still make it obvious to undo. – Jim Mack Apr 21 '15 at 18:37
  • Yeah, I did that and it ended up eliciting spam answers and a mean-spirited attack on me personally by AJ Henderson who didn't even understand the question. I notice that her cronies actually downvoted my QUESTION! WOW! – hmj6jmh Jan 12 '16 at 16:35
  • "Despite the default flag setting 0 (false), the subtitle track is still active by default in players" which players do this?! All the ones I've tried respect the default flag without an issue. – Michael Berry Apr 29 at 21:51
6

While your self-selected answer will work, it requires modifying the file again when you do want the subtitles.

Why not just create an empty but syntactically valid SRT file and mux that as the first subtitle stream (leaving the original as a secondary stream)? Even if the player is set to display subs, nothing will show up. No need to mess with ID strings.

And when you do want to see subtitles, you should be able to switch to the (populated) secondary subtitle stream, from within the player. No need to modify the file.

  • Because it is much more work and goes against the first point in the OP. This is about disabling subtitles WITHOUT remuxing. – hmj6jmh Jan 12 '16 at 16:37
4

I gave up and contacted the author of mkvpropedit to ask if it was possible to do what I wanted to do. The first answer I got was 'No'. But I persevered and asked if there was any setting that will trick the player into not recognizing a subtitle track? The response was to set the Codec ID to something the player doesn't support. Eureka!

mkvpropedit --edit track:4 --set codec-id=DISABLED "inputfile.mkv"

| + A track
|  + Track number: 4 (track ID for mkvmerge & mkvextract: 3)
|  + Track UID: 11363869179551629452
|  + Track type: subtitles
|  + Default flag: 0
|  + Lacing flag: 0
|  + Codec ID: DISABLED
|  + Name: CC

This worked! The player doesn't recognize any subtitle track. In milliseconds I have achieved my goal. No time-consuming remux. Nice.

The procedure for doing this hack is as follows:

  1. Get track number of the subtitle track

    mkvinfo "inputfile.mkv"
    …
    | + A track
    |  + Track number: 4 (track ID for mkvmerge & mkvextract: 3)
    |  + Track UID: 11363869179551629452
    |  + Track type: subtitles
    |  + Default flag: 0
    |  + Lacing flag: 0
    |  + Codec ID: S_TEXT/UTF8
    |  + Name: CC
    …
    

    OR

    mkvmerge --identify "inpufile.mkv" | grep subtitles 
    Track ID 3: subtitles (SubRip/SRT)
    

    Note that mkvinfo gives the proper 1-indexed track number that mkvpropedit uses, BUT mkvmerge gives a 0-indexed number so you have to add 1. Be sure to do this or you'll mess up the wrong track!

  2. Change the Codec ID to some nonsense name so the track is not recognized as a subtitle track. (In this case the track number is 4 but it will be different for other files.)

    mkvpropedit --edit track:4 --set codec-id=DISABLED "inputfile.mkv"
    
    | + A track
    |  + Track number: 4 (track ID for mkvmerge & mkvextract: 3)
    |  + Track UID: 11363869179551629452
    |  + Track type: subtitles
    |  + Default flag: 0
    |  + Lacing flag: 0
    |  + Codec ID: DISABLED
    |  + Name: CC
    
    Track ID 3: subtitles (DISABLED)
    

If you think you may at some time want to enable the track, keep a copy of the original Codec ID. As suggested by Jim Mack, it would be expedient to just add an obvious character to the existing Codec ID, thus preserving the original ID.

This hack works on files that have multiple subtitle tracks. Just repeat the renaming procedure for each track.

  • This is the answer. All other answers given do not respect the conditions of the OP. – hmj6jmh Jan 12 '16 at 16:39
  • I renamed Codec ID to DISABLED, but VLC still displays all subtitles in the dropdown menu (selecting returns an error). In addition Popcorn AudioConverter or rather one of its used batch tools returns an error while remuxing the file. – mgutt Jun 15 at 14:24
4

What player are you using?

Unless you have the "forced" flag set, it's a player option whether subtitles are displayed automatically or not and in which language if you have several subtitle tracks.

First, set the "default-flag" to false:

mkvpropedit video.mkv --edit track:s1 --set flag-default=0

Then lookup your player preferences.

In VLC (2.0.8), I had to follow these instructions:

To disable subtitles by default, select "Preferences", then "Show All". Select "Input/Codecs". On the "Subtitle Track ID" selection window, change the value to "-1".

and also set the preferred language to "none".

In SMplayer, uncheck Preferences / Subtitles / "Select first available subtitle".

Once your "default" flag is set to false for all subtitle tracks, it only depends on your player preferences.

  • You didn't read the OP. Disabling subtitles in the player is obvious but not at all what I wanted. I want English subtitles to display but not any other languages. Setting the default flag does not work. That is why I went to the trouble of finding a method that works universally and published my findings here. – hmj6jmh Jan 12 '16 at 16:32

protected by AJ Henderson Jan 12 '16 at 14:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.