8

I have an mkv with multiple subtitle streams. I know I can use mkvextract to extract one of those subtitle streams to a file, for example, sub.srt. I can then burn those subtitles into the new video with ffmpeg like so:

ffmpeg -i video.mkv -vf subtitles=sub.srt out.mp4

I also know I can use -map to select video, audio, and subtitle tracks and encode those into the new video, again something like so:

ffmpeg -i video.mkv -map 0:0 -map 0:1 -map 0:4 -c:v copy -c:a copy -c:s copy out.mp4

However, what I can't figure out is how to transcode a video and burn in the subtitles into the new file (not just adding a subtitle track, but burning them into the video) not by reading it from a subtitle file but directly from the old video stream itself.

Any ideas?

2
  • 1
    Though not using ffmpeg directly, Handbrake does that off the box. Commented Aug 28, 2013 at 4:45
  • Thanks for the info, but I'm really curious as to how to do it with ffmpeg alone.
    – Ben
    Commented Aug 28, 2013 at 16:31

1 Answer 1

7

I recently stumbled upon this post and I do know the answer to it. I hope it can help other people as well.

What you basically do is also put the mkv file in the subtitles variable. You can add :si=0 (subtitle index) that takes the first subtitle stream it can find. You'll have to use the double and single quote if the file has spaces in it.

ffmpeg -i video.mkv -vf "subtitles='video.mkv':si=0" out.mp4
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .