2

I created a mp4 file from video, audio and .srt file.

ffmpeg -i video.mp4 -i audio.m4a -i sub.srt -map 0:0 -metadata:s:v:0:0 language=eng -map 1:0 -metadata:s:a:0:0 language=eng -map 2:0 -metadata:s:s:0:0 language=eng -c copy -scodec mov_text out.mp4

It works fine, but subtitle is not shown by default. Is there way to show the subtitle by default?

1

You can use MP4Box 0.6.2-DEV-rev453 (May 2016) or higher to do this:

mp4box -add xr.mp4 -add xr.en.srt:txtflags=0xC0000000 -new ya.mp4

This will mark the subtitle stream in the output file as forced. However, this mark will only be recognized starting with VLC 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 xr.mp4 -i xr.en.srt -c copy -c:s mov_text -disposition:s forced ya.mp4

However after having tried it with both "forced" and "default", the subtitles marked by FFmpeg are not recognized as forced by VLC.


To respond to the comment, here is a test with MP4Box 0.7.0 (Apr 2017) and VLC 3.0.0-20170926 (Sep 2017). Note more recent VLC versions are having a crashing problem, even on videos without subtitles. Using this file:

youtube-dl --write-auto-sub --format 18 --output xr.mp4 kcs82HnguGc
ffmpeg -i xr.en.vtt xr.en.srt
mp4box -add xr.mp4 -add xr.en.srt:txtflags=0xC0000000 -new ya.mp4

Result:

sub

  • @Pygmalion no it is germane - if you are reading carefully you notice I said you cannot use past VLC 3.0.0-20170926 otherwise it will crash - you ignored this and did it anyway - to your own chagrin - I have now reported you for repeatedly ignoring my full answer – Steven Penny Oct 11 '17 at 18:45
  • There is nothing wrong with your asnwer, I never claimed that, so I don't know what is there to report about? The problem is that existing solutions for forced subtitles are not robust and not useful for general public. – Pygmalion Oct 11 '17 at 19:21
  • To explain "robust": Imagine you want to see some video. The instruction is: You cannot see it online. And you cannot see it downloaded either, unless you use one special program, and, wait, you may not use the official version of this program, but only special version, but wait you can use only versions newer than this date and older than this date... average response would be - to hell with this video. I am prepared to do anything that my video will have user-friendly forced subscripts, which is in this moment obviously not possible. In a few years I will try again... – Pygmalion Oct 11 '17 at 19:34
  • @Pygmalion good comment - the current situation is not good - best to wait for nightly versions to graduate to release – Steven Penny Oct 11 '17 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.