ffmpeg - Subtitles - Add subtitles from another file

Assuming

ffmpeg -i a.mkv -i b.mkv -c:v copy -c:a copy -c:s copy -map 0:0 -map 0:1 -map 1:2 -y out.mkv

NOTE: The mapping syntax is:

  • 0:0 refers to stream 0 from file 0 (the first file, which is a.mkv).
  • 0:1 refers to stream 1 from file 0 (the first file, which is a.mkv).
  • 1:2 refers to stream 2 from file 1 (the second file, which is b.mkv).

To determine the mapping for the subtitle, run:

ffmpeg -i b.mkv

and see which stream contains the subtitle data.