Add Multiple SRT Subtitles to MKV with FFmpeg

This article provides a quick guide on how to use FFmpeg to multiplex multiple SubRip (SRT) subtitle files into a single Matroska (MKV) video container. You will learn the exact command-line syntax required to map multiple input files, assign 3-letter ISO language codes (such as English, Spanish, or French) to each subtitle track, and save the output without re-encoding the original video or audio streams.

The FFmpeg Command

To merge a video file and multiple SRT files into one MKV file, use the following command structure:

ffmpeg -i input.mp4 -i english.srt -i spanish.srt -i french.srt \
-map 0:v -map 0:a -map 1 -map 2 -map 3 \
-c copy \
-metadata:s:s:0 language=eng -metadata:s:s:0 title="English" \
-metadata:s:s:1 language=spa -metadata:s:s:1 title="Español" \
-metadata:s:s:2 language=fre -metadata:s:s:2 title="Français" \
output.mkv

Command Breakdown

  • -i input.mp4 -i english.srt ...: Specifies the input files. FFmpeg indexes inputs starting from 0. In this example, the video is index 0, the English subtitle is index 1, the Spanish subtitle is index 2, and the French subtitle is index 3.
  • -map: Tells FFmpeg which streams from the inputs to include in the output.
    • -map 0:v maps the video stream from the first input.
    • -map 0:a maps the audio stream from the first input.
    • -map 1, -map 2, and -map 3 map the subtitle files in order.
  • -c copy: Copies the video, audio, and subtitle streams directly without re-encoding them. This process is extremely fast and preserves the original quality.
  • -metadata:s:s:0 language=eng: Sets the metadata for the subtitle streams.
    • The syntax s:s:0 targets the stream of type subtitle at index 0 (the first subtitle track mapped, which is english.srt).
    • language=eng sets the language using the ISO 639-2 three-letter code (e.g., eng for English, spa for Spanish, fre or fra for French).
  • -metadata:s:s:0 title="English": Sets a user-friendly name for the track that displays in media players.

Setting a Default Subtitle Track (Optional)

By default, media players may play the first subtitle track automatically or none at all. You can explicitly define which subtitle track is enabled by default using disposition flags.

For example, to make the English track (s:s:0) the default and disable auto-play for the others, add these flags to your command:

-disposition:s:s:0 default -disposition:s:s:1 0 -disposition:s:s:2 0