Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ffmpeg

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?

like image 388
user25 Avatar asked Jan 08 '18 23:01

user25


2 Answers

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.

like image 156
llogan Avatar answered Nov 09 '22 02:11

llogan


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

like image 35
user25 Avatar answered Nov 09 '22 01:11

user25