开发者

Java: How to read available audio tracks in a video file?

开发者 https://www.devze.com 2023-03-05 16:22 出处:网络
Some video files contain multiple audio tracks. Multiple languages for example. Is there a library w开发者_如何学编程hich gets information about these audio tracks? Names of the audio tracks would be

Some video files contain multiple audio tracks. Multiple languages for example. Is there a library w开发者_如何学编程hich gets information about these audio tracks? Names of the audio tracks would be sufficient.

It should support common formats (mkv, avi,...)


I believe the best monolithic media file library available is that for VLC player. I seem to remember there was a Java wrapper, but it's probably not maintained (like all Java wrappers more than a few weeks old heheh).


I have found a solution to my problem. From Java I call the following command:

ffmpeg -i myvideo.mkv

Then I read the commands output and filter the lines which start with Stream #.

This works on all my files with multiple audio tracks.

0

精彩评论

暂无评论...
验证码 换一张
取 消