Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
999 views
in Technique[技术] by (71.8m points)

video - ffmpeg set subtitles track as default

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...