Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a mkv file and want to convert it to an DVD compatible mpg file with avconv. How can I also burn-in one subtitle stream from the same mkv file?

avconv -i input.mkv -map 0:0 -map 0:1 -target pal-dvd -aspect 16:9 -q:v 1 -acodec mp2 -ac 2 -ab 128k output.mpg

share|improve this question
up vote 5 down vote accepted

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

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 output.mpg


  • 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.

share|improve this answer
Thanks for your help but the extraction doesn't work. I get the following error message "Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height". The subtitle stream is announced as "Subtitle: hdmv_pgs_subtitle". Do you know what the problem is? – user4811 Sep 21 '13 at 23:06
Thx! I have also tried this but subtitles don't appear and I get the message "sub2video: rectangle overflowing". I have figured out that the problem is that the source was converted from 1080p to 720p but the subtitles are still 1080p. Is is possible to scale the subtitle stream to 720p before overlaying? – user4811 Sep 22 '13 at 12:09
Yes, that should be possible. "[0:s]scale=-1:720[subs];[0:v][subs]overlay[v]" or something. I cannot test it right now, but something like that should work. – slhck Sep 22 '13 at 12:32
Damn, still get "sub2video: rectangle overflowing" and no subtitles in the output. This is correct, or? ffmpeg -i input.mkv -filter_complex "[0:s]scale=-1:720[subs];[0:v][subs]overlay[v]" -map [v] -map 0:a:0 -target pal-dvd -aspect 16:9 -q:v 1 -c:a mp2 -ac 2 -b:a 128k output.mpg – user4811 Sep 22 '13 at 13:04
The solution is the "-canvas_size" parameter to specify the canvas for subtitles. It should be the first parameter! – user4811 Sep 22 '13 at 15:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.