Text-based subtitles
ffmpeg has a subtitles
filter that can burn SRT files into the video stream. You need ffmpeg compiled with --enable-libass
though. I don't think Libav has something similar, at least looking over the available filters.
You first need to extract the subtitles. -map 0:s:0
selects the first subtitle stream for the output, and -c:s:0
selects the codec for it – just to make sure it's really SRT.
ffmpeg -i input.mkv -an -vn -map 0:s:0 -c:s:0 srt subtitles.srt
Then, burn them in.
ffmpeg -i input.mkv -map 0:0 -map 0:1 -target pal-dvd -aspect 16:9 -q:v 1 \
-c:a mp2 -ac 2 -b:a 128k -filter:v subtitles=subtitles.srt output.mpg
Note:
The above command is assuming that streams 0:0
and 0:1
in your input are the video and audio streams, respectively. If you only want to prevent the subtitles from being included in the output file, then you can also add -sn
to disable them altogether.
You have to change -ab
to -b:a
, since the former is a non-existing option for ffmpeg.
Image-based subtitles
In case your input has image-based subtitles like HDMV PG (seems MakeMKV is creating those, and other tools are unable to extract them), you can try using the overlay filter to burn them in:
ffmpeg -i input.mkv -filter_complex "[0:v][0:s]overlay[v]" -map [v] -map 0:a \
-target pal-dvd -aspect 16:9 -q:v 1 -c:a mp2 -ac 2 -b:a 128k output.mpg
This is also explained on the FFmpeg Wiki.
In case your subtitles come in different dimensions than the original movie (e.g. because the video stream was scaled down but the subtitles weren't), you can try using the -canvas_size
option to set the size.