user25
user25

Reputation: 3195

show subtitles list, get id and name of each subtitles track

I would like to get some list of all available subtitles tracks like:

#1 - id, name
#2 - id, name
#3 - id, name
...

So list would tell how much subtitles tracks I have, show id and name of each track

Is there any FFmpeg option to show such list?

Upvotes: 14

Views: 12702

Answers (2)

llogan
llogan

Reputation: 133743

Example

ffprobe command to list the stream ID and language:

ffprobe -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 input.mkv

Result

5,eng
6,fao
7,ain

This shows the stream id #5 is English, #6 is Faroese, and #7 is Ainu. See List of ISO 639 codes (refer to 639-2/T or 639-2/B) for the language abbreviations.

-map option

You can use this information to create your command. If you want the English and Ainu languages use:

-map 0:5 -map 0:7

or

-map 0:s:0 -map 0:s:2

or

-map 0:s:m:language:eng -map 0:s:m:language:ain

See the -map option documentation for more info.

Upvotes: 28

user25
user25

Reputation: 3195

FFmpeg seems doesn't have such option

so we can only parse all printed data by ffmpeg -i VIDE_FILE_NAME (filtering out not stream text track lines)

also FFmpeg doesn't really prints that ID (it's just stream position made by FFmpeg) like MediaInfo would print

Upvotes: 1

Related Questions