5

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
  • 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, 2015 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, 2016 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. Apr 29, 2019 at 21:51

3 Answers 3

9

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.

3
  • 1
    This is the answer. All other answers given do not respect the conditions of the OP.
    – hmj6jmh
    Jan 12, 2016 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, 2019 at 14:24
  • Not enough karma to post a proper answer. But, I found my way here because I was wondering why vlc insisted on showing English subs in some English-audio mkv files I had. Turns out, players are smarter than we give them credit for, they just need all the information. By properly setting the language on the audio and subs tracks and default the English subs track to off, the subs are still there but not shown. Assuming your file only has 1 audio and 1 sub track: mkvpropedit file.mkv --edit track:a1 --set language=eng --edit track:s1 --set language=eng --edit track:s1 --set flag-default=0 Feb 19, 2022 at 5:30
7

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.

2
  • 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, 2016 at 16:32
  • Using MakeMKV for some reason subtitles are always enabled (shows up in both VLC and apple tv) I used your script do make this one liner to set the default flag on all mkv files in a given directory. Thanks! Works great. for FILE in *.mkv; do mkvpropedit $FILE --edit track:s1 --set flag-default=0; done
    – tabrindle
    Sep 20, 2020 at 17:13
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.

2
  • 1
    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, 2016 at 16:37
  • Exactly! I'm specifically looking for something just like the op described and remuxing is not an option. To provide more context: I'd like to disable subtitles in a very large number of large files. They're on a networked file system so I'd like to do this with minimal network traffic. Fortunately, the file system can apply binary diffs for small changes to large files. Remuxing would still require downloading the entire file so that isn't ideal. The accepted answer is hacky, but works great so far!
    – Chris
    Dec 10, 2019 at 3:49

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