User Tools

Site Tools


ffmpeg:subtitles:add_subtitles_from_another_file

ffmpeg - Subtitles - Add subtitles from another file

Assuming

  • a.mkv contains only the video and audio.
  • b.mkv contains some subtitle data to be included
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.

ffmpeg/subtitles/add_subtitles_from_another_file.txt · Last modified: 2024/12/30 19:37 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki