Search code examples
javamedialibvlcvlcj

How to distinguish between audio file and video file?


I am using Java to write a media application.

Given a file, how can I know is it a audio file or video file?

By the way, I use vlcj library.


Solution

  • In Java 7 you will be able to use java.nio.file.probeContentType to do this.

    In the meantime, there are a number of other options for doing this kind of thing.