ffmpeg set subtitles track as default

笑着哭i 提交于 2020-05-20 13:44:53

问题


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?


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/26956762/ffmpeg-set-subtitles-track-as-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!