Is there an option in ffmpeg to specify a subtitle track that should be shown by default?
The previously accepted answer is no longer correct, since the disposition
flag has been added to ffmpeg. Using the example you provided, you could set the subtitle track to display by default as follows:
ffmpeg -i movie.mp4 -i movie.srt -c:v copy -c:a copy -c:s mov_text \
-metadata:s:s:0 language=eng -disposition:s:0 default movie-sub.mp4
The format is -disposition[:stream_specifier] value
.
If you need to remove a previously set disposition from a stream (for example, a stream is set to default
, but you want to disable this), use the value 0
.
You can see the list of available disposition options and additional examples in the ffmpeg documentation by searching for "disposition".
You can use MP4Box 0.6.2-DEV-rev453 (May 2016) or higher to do this:
mp4box -add alfa.mp4 -add bravo.srt:txtflags=0xC0000000 -new charlie.mp4
Example
This will mark the subtitle stream in the output file as forced.
However, this mark will only be recognized starting with these versions of programs:
MPC-HC 1.7.10.207 (May 2016)
VLC media player 3.0.0-20161101 (Nov 2016)
I have seen mentions to this post on the FFmpeg mailing list about a patch that implements disposition for FFmpeg:
ffmpeg -i alfa.mp4 -i bravo.srt -c copy -c:s mov_text -disposition:s forced charlie.mp4
However after having tried it with both "forced" and "default", the subtitles marked by FFmpeg are not recognized as forced by either MPC-HC or VLC.