Delete Specific Subtitle from MKV with FFmpeg
This article explains how to remove a specific subtitle stream from an MKV container using FFmpeg’s stream mapping functionality. By utilizing negative mapping, you can target and exclude an unwanted subtitle track—such as a specific language or commentary track—while preserving all other video, audio, and subtitle streams without undergoing a time-consuming re-encoding process.
Step 1: Identify the Subtitle Stream Index
Before you can delete a specific subtitle, you need to identify its index number. Run the following command in your terminal to inspect the streams inside your MKV file:
ffmpeg -i input.mkvLook at the output lines starting with Stream #0:. You
will see listings for video, audio, and subtitles. Note the index of the
subtitle stream you want to remove. For example: *
Stream #0:2: Subtitle: subrip (This is subtitle index
0:s:0) * Stream #0:3: Subtitle: subrip (This
is subtitle index 0:s:1)
Step 2: Run the FFmpeg Command using Negative Mapping
FFmpeg uses the -map option to select streams. To delete
a specific stream, you first map all streams from the input file and
then use a negative map (prefixed with a minus sign -) to
exclude the specific subtitle track.
To delete the second subtitle stream (index 1, which
corresponds to 0:s:1), run this command:
ffmpeg -i input.mkv -map 0 -map -0:s:1 -c copy output.mkvCommand Breakdown:
-i input.mkv: Specifies the source video file.-map 0: Selects all streams (video, audio, subtitles, attachments) from the first input file.-map -0:s:1: The minus sign tells FFmpeg to exclude the specified stream. Here,0is the input file,sstands for subtitle streams, and1is the index of the specific subtitle stream you want to delete (using zero-based indexing).-c copy: Instructs FFmpeg to stream copy all selected tracks. This prevents re-encoding, preserving original quality and completing the process in seconds.output.mkv: The name of the new MKV file without the deleted subtitle stream.