Skip to content

Instantly share code, notes, and snippets.

@Cougar
Created June 4, 2016 21:26
Show Gist options
  • Save Cougar/0f8b4bc028df9856b7af6fad018bff2e to your computer and use it in GitHub Desktop.
Save Cougar/0f8b4bc028df9856b7af6fad018bff2e to your computer and use it in GitHub Desktop.
Add new subtitle to MKV file
ffmpeg -i source.mkv -f srt -i source.srt -map 0 -c:v copy -c:a copy -scodec copy -map 1 -scodec srt -metadata:s:s:10 language=est new.mkv
@Cougar
Copy link
Author

Cougar commented Jun 4, 2016

"10" is a subtitle index counted from 0. 10 means that there are already 10 subtitles (0-9) and added one will be 10th. If this is the only subtitle, then use index "0". Subtitle stream will be 12 or more (one for video, one or more for audio and then subtitles from 2 or upwards).

@Cougar
Copy link
Author

Cougar commented Jun 12, 2016

To extract subtitle for existing MKV file use (0:4 is subtitle stream):

ffmpeg -i source.mkv -an -vn -map 0:4 -c:s:0 srt subtitle4.srt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment