[FFmpeg-user] Force Subtitle Detection

petesea at frontier.com petesea at frontier.com
Tue Mar 17 17:51:24 CET 2015

On Tue, 17 Mar 2015, Nicholas Robbins wrote:

> What happens if you add "-forced_subs_only 1" to your command. Something like:
> ffprobe -forced_subs_only  1 -count_frames -select_streams s -show_streams IN.mkv

Yes, that does work, so it's definitely an option...

But it means I'll need to do 2 complete scans - one to get the total 
number of subtitles in each stream and a 2nd scan to get only the forced 
subtitles in each stream.  Not the end of the world, just trying to see if 
I can do this in the most efficient way possible.

Assuming there isn't some other piece of info currently available I'm 
missing, I can see a couple ways to do this in one pass, but both would 
require code changes.

1. Add a new "nb_forced_frames" entry to the "-show_streams" section 
that's calculated similar to "nb_read_frames" when the "-count_frames" 
option is used.  Probably this entry would only make sense for subtitle 
frames and probably only dvdsubs.

2. Add a new "forced" (or "forced_subs" or something like that) entry to 
the "-show_frames" section for subtitles (maybe only dvdsubs?) which is 
just a flag indicating if that frame is forced or not.  This would require 
the calling application to calculate the total number of forced frames 
itself, so it would be more cumbersome and probably not as efficient.

> This will only work if your subs are dvdsubs.

Yes, I am only looking at dvdsubs.

More information about the ffmpeg-user mailing list