Use FFmpeg to add text subtitles
14:30 29 Dec 2011

I am trying to add text subtitles to an MP4 container using FFmpeg:

ffmpeg -i input.mp4 -i input.srt -map 0.0 -map 0.1 -map 1.0 output.mp4

When I am trying to run this line, it gives me an error:

Nmber of stream maps must match number of output streams.

If I try to change the MP4 file to Matroska—filename extension .mkv— (although MP4 supports text subtitles), it is like this:

ffmpeg -i input.mp4 -i input.srt -map 0.0 -map 0.1 -map 1.0 output.mkv

It correctly maps the streams, but it gives an error:

Encoder (codec id 94210) not found for output stream #0.2

When I launch

ffmpeg -codecs

I can see that the SRT codec is supported as decoder and encoder. However, I am not sure what is used for MP4 and Matroska subs encoding, and whether I need to switch it on or compile separately.

ffmpeg mp4 subtitle srt