Use ffprobe to view audio tracks by language [closed]

我只是一个虾纸丫 提交于 2021-02-17 06:07:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!