Ubuntu – Howto overlay subtitles onto video using avconv

avconv

I am using the following script to overlay a dvdsub stream and a video stream;

avconv -i input.mkv \
       -i subtitles.sub -filter_complex "[0:v:0][1:s:0]overlay[vid]" -map "[vid]" \
       -s hd720 -sws_flags lanczos \
       -vcodec libx264 -crf 20 -preset medium \
       ~/Desktop/test.mkv

I get the following error ;

Stream specifier ':s:0' in filtergraph description [0:v:0][1:s:0]overlay[vid] matches no streams.

No matter what I do I just cannot get this to work. Can any one tell me how to 'burn-in' subtitles using avconv (or ffmpeg) ?

Best Answer

For anybody who is interested, I figured it out ..... avconv can't do it, ffmpeg can. I have now made the switch to ffmpeg and will drop avconv.

I compiled the latest version of ffmpeg (v 2.3.3). I converted my 'sup' format subtitles to 'sub/idx' format, then specified the '.idx' file as the subtitle file and the overlay process worked a treat.

The final command is;

ffmpeg -i input.mkv -i subtitles.idx -filter_complex '[0:v][1:s]overlay[vid]' -map '[vid]' -s hd720 -sws_flags lanczos -vcodec libx264 -crf 20 -preset medium ~/Desktop/test.mkv

x264 settings can be configured as desired, off course.