Get Video file metadata in Java

2019-04-03 00:14发布

问题:

I have been trying to find a way to get the metadata out of video files such as frame rate, length, codec, aspect ratio. What java libraries are out there that would be good for this?

回答1:

You can use VLCJ (GPL license)

VLCJ wraps around libVLC DLL library (the library used in VLC) via JNA for Java app. It supports reading the metadata from a media file via MediaPlayer.getMediaMeta()

Take note: certain versions of VLCJ don't work in full functionality with certain versions of libVLC. For example, VLCJ 1.2.x only works perfectly well with libVLC 1.2.0 (which is not released yet - a nightly build at the moment). If you use it with libVLC 1.1.x, it won't be able to read media file metadata via MediaPlayer.getMediaMeta(). In this case, you need to get the correct libVLC library for VLCJ version you choose.

http://code.google.com/p/vlcj/wiki/WhichVersion

VLCJ 1.2.x has some design changes when compared to VLCJ 1.1.x which may frustrate seasoned developer of VLCJ but it is for the good reasons.