[FFmpeg-user] change defaults for subtitle streams

Peter White peter.white at posteo.net
Thu Aug 11 17:26:43 EEST 2016


Hi!

11.08.2016 14:23, MikoĊ‚aj Machowski:
> I have video with four streams: 0:0 video, 0:1 audio, 0:2 sub1, 0:3 sub2

 > Result of normal settings is that both subtitle streams are default

Which container or file type is this? I know for certain that multiple
default streams of the same kind are not allowed in the matroska (.mkv)
format. For other formats, I am not sure but it does not make sense to
have more than one default stream per type.

> and  various players are interpreting this differently eg. ffplay is loading
 > sub1 because this is first, vlc is loading sub2 because this is the last
 > with default flag.

Case in point. This file should have never existed. ;)

> How to 'undefault' one of streams and add descriptions?

You need to change the "disposition", like this:

$ ffmpeg -i bad_file.mkv -c copy -map 0 -disposition:s:1 -default 
good_file.mkv

More generally it goes like:

$ ffmpeg -i input -c copy -map 0 -disposition:stream_spec flags output

More info on stream_spec can be found in the "Stream specifiers"
section of the ffmpeg manual.

So, this also works:
$ ffmpeg -i input -c copy -map 0 -disposition:s:1 +default+forced output

Well, in most cases it works that way. I think for your question this
answer is valid. But I think I discovered some curiosities while
testing this feature, when stream_spec is only the type without index,
so I am not certain, if this is a bug or my above generalisation is
just too broad. So, for the time being, take it with a grain of salt. :)


Best,
Peter


More information about the ffmpeg-user mailing list