25

By adding an .ass subtitles track to an mkv video with ffmpeg, it isn't set as default track, so on playback you have to manually turn on subtitles. Is it possible to set the default flag for the subtitles track?

ffmpeg command used:

ffmpeg -i video.mp4 -i subtitles.ass -c:v libx264 -preset veryslow \
 -pix_fmt yuv420p10le -c:a copy -c:s copy output.mkv

Note that I want to keep .ass subtitle format, not convert the subtitles to mov_text like suggested in this similar question: How to set default streams with ffmpeg

There is the possibility to set the default flag afterwards with mkvpropedit like this:

mkvpropedit output.mkv --edit track:s1 --set flag-default=1

But is it possible to do this directly with ffmpeg?

Community
  • 1
  • 1
blörk
  • 279
  • 1
  • 3
  • 4
  • SO is probably the wrong site for this question, but the question itself is valid. I have the same issue. – Tobia Dec 17 '14 at 23:15

2 Answers2

31

I think as per this patch this is now possible. At least for me it works with:

ffmpeg -i in.mp4 -i in.srt -c copy -disposition:s:0 default out.mkv

Note s in -disposition:s:0 in this case stands for subtitle and not stream. To select the second steam by index use -disposition:1.

13

You can use 'forced' instead of default to force vlc to play it

ffmpeg -f mp4 -i outfile.mp4 -f srt -i VTS_07_0.EnglishV2.srt -c:v copy -c:a copy -metadata:s:a:0 language=Japanese -c:s mov_text -metadata:s:s:0 language=English -disposition:s:s:0 forced mix.mp4
Jake Conway
  • 901
  • 16
  • 25
MRDKVV
  • 131
  • 1
  • 2
  • 2
    Thanks,this works great. Question: why do you use the `s` subtitle identifier twice, i.e. `-disposition:s:s:0` rather than `-disposition:s:0`? Trying to fully understand your syntax. – RocketNuts Jan 27 '19 at 14:39
  • 2
    @RocketNuts: The first `s` is for "stream", the second is for `subtitle`. This is described in the documentation for ffmpeg's `-map_metadata` switch. (That's for `-metadata`, though. Based on the docs, I don't think it's correct to do that for `-disposition`.) – Nate C-K Apr 09 '19 at 03:36
  • Forced has a special meaning though. It refers to subtitles with non-native dialog that are meant for the viewer to understand. For instance in a video with English sound, just the non-English dialog would be translated to English and displayed as "forced". A subtitle for this video that includes both English and potential non-English dialog, is per definition not forced. So if it is a "regular" subtitle, I would stick with `default` as opposed to `forced`. More information: https://partnerhelp.netflixstudios.com/hc/en-us/articles/224198488-What-is-a-Forced-Narrative-Subtitle- – dropbear May 19 '23 at 09:13