How to Extract MKV Subtitles to ASS Using FFmpeg
Extracting subtitle tracks from Matroska (MKV) video containers and
converting them into the Advanced SubStation Alpha (ASS) format is a
quick process when using FFmpeg. This guide provides a straightforward,
step-by-step tutorial on how to use this powerful command-line tool to
identify the correct subtitle stream within your MKV file, extract it,
and convert it directly into a .ass file.
Step 1: Identify the Subtitle Track Index
An MKV file can contain multiple video, audio, and subtitle tracks. Before extracting, you must identify the index number of the subtitle track you want. Open your terminal or command prompt and run the following command:
ffmpeg -i input.mkvReplace input.mkv with the path to your video file.
Scroll through the output to find the “Stream” details. Look for lines
labeled Subtitle.
For example, you might see:
Stream #0:0: Video: h264...
Stream #0:1: Audio: ac3...
Stream #0:2(eng): Subtitle: subrip (default)
Stream #0:3(fre): Subtitle: subrip
In this example, the English subtitle track is at index
0:2 (or the first subtitle stream 0:s:0), and
the French subtitle track is at index 0:3 (or the second
subtitle stream 0:s:1).
Step 2: Extract and Convert the Subtitle to ASS
Once you know the stream index, use the -map option to
select that stream and output it as an .ass file. FFmpeg
will automatically handle the conversion.
Option A: Extract the First Subtitle Track
If you want to extract the very first subtitle track in the file, run:
ffmpeg -i input.mkv -map 0:s:0 output.ass-i input.mkv: Specifies the input video file.-map 0:s:0: Selects the first subtitle stream (s:0) of the first input file (0).output.ass: The desired output filename. The.assextension tells FFmpeg to convert the format.
Option B: Extract a Specific Subtitle Track (By Index)
If you want to extract a specific track identified in Step 1 (for
example, the French subtitle at stream 0:3), map the exact
index:
ffmpeg -i input.mkv -map 0:3 output.ass-map 0:3: Directs FFmpeg to copy only the stream located at index0:3.
Step 3: Extract Subtitles Without Re-encoding Video/Audio
The commands above are highly efficient because FFmpeg automatically
ignores the video and audio streams when saving to a subtitle-only
output format like .ass. The process takes only a few
seconds to complete.