问题
I wish to use ffprobe to list all audio streams, and show what language is used.
Simply this is part of me trying to find ways to automatically remove non-english tracks from video files.
I am new to ffprobe, but have had some experience using ffmpeg.
Because I know that there is no guarantee of what order the language tracks may be.
That is why I think it is vital to list each track, by number, then language, then when I know this part works, figure out how to remove the non-english ones.
Thanks for your time.
回答1:
Running this ffprobe command
ffprobe in.mp4 -show_entries stream=index:stream_tags=language -select_streams a -of compact=p=0:nk=1
will produce this output
1|eng
2|deu
3|eng
4|eng
5|fre
The first value is the absolute stream index, and the 2nd value the language tag assigned.
To remove only and all english tagged audio streams, run
ffmpeg -i in.mp4 -c copy -map 0 -map -0:m:language:eng NoEng.mp4
To keep only english tagged audio streams, run
ffmpeg -i in.mp4 -c copy -map 0:v -map 0:m:language:eng OnlyEng.mp4
来源:https://stackoverflow.com/questions/40647168/use-ffprobe-to-view-audio-tracks-by-language