Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 am having troubles adding subtitles to a video file using ffmpeg.

I am using this command:

ffmpeg -i movie_input.m4v -newsubtitle -acodec copy -vcodec copy movie_output.m4v

I found this command line example in various tutorials but for some reason (a newer version of ffmpeg?) it gives me:

Unrecognized option 'newsubtitle'

Any clue as to how can I add subtitles using ffmpeg?


P.S. I need a solution that can be automated in a bash script, so using programs like Subler are not fit for this task.

share|improve this question
up vote 6 down vote accepted

-newsubtitle is an obsolete option from old versions of ffmpeg; with more modern versions, the command will look like this:

ffmpeg -i input.m4v -i -map 0 -map 1 -c copy -c:s mov_text output.m4v

-i input.m4v -i tells ffmpeg to use those two files as its inputs.

-map 0 -map 1 tells ffmpeg to use all the streams from input number 0 and input number 1.

It's not directly relevant to this, but you can select individual streams with -map: -map 0:v would select all video streams from input 0, -map 1:s would select all subtitle streams from input 1, -map 0:0 would select stream 0 (the first stream) from input 0, -map 1:a:0 would select the first audio stream of input 1.

-c copy tells ffmpeg to copy all streams from the input without re-encoding, while having -c:s mov_text after the -c copy overrides the copy setting for the subtitle stream, re-encoding it to a form the MP4 container can contain.

share|improve this answer
Is there a way to burn-in the subtitles to a m4v file using ffmpeg? – Koray Tugay Oct 24 '14 at 8:22
@KorayTugay Yes. If you need any help not contained in that link, feel free to ask a question (and don't forget to tag it with ffmpeg). – evilsoup Oct 24 '14 at 8:27
I am confused because examples here do not contain m4v. – Koray Tugay Oct 24 '14 at 11:23

With FFmpeg 0.9, the -newsubtitle option was removed. If you want to add all input files' video/audio/subtitle streams to the output, use the -map options, e.g.:

ffmpeg -i movie_input.m4v -i -c:v copy -c:a copy -c:s mov_text \
-map 0 -map 1 out.m4v

This will copy video and audio streams, but encode the subtitles to mov_text, which is the only officially supported subtitle format for MP4. SRT by default won't work.

The map options here specify that all the streams from the first file (0) and the second file (1) will be copied, so it'd work even if your original had multiple audio streams, for example.

For a detailed article on how to use the map option, see the FFmpeg wiki.

Reason for removing those options from the Changelog:

-newvideo/-newaudio/-newsubtitle options were removed. Not only were they irregular and highly confusing, they were also redundant. In avconv the -map option will create new streams in the output file and map input streams to them. E.g. avconv -i INPUT -map 0 OUTPUT will create an output stream for each stream in the first input file.

share|improve this answer

You must log in to answer this question.

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