问题描述
我一直在尝试找到一种方法来从视频文件中提取元数据,例如帧速率,长度,编解码器,宽高比.那里有哪些Java库对此有好处?
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?
推荐答案
您可以使用 VLCJ(GPL许可)
VLCJ通过JNA for Java应用程序包装libVLC DLL库(在VLC中使用的库).它支持通过MediaPlayer.getMediaMeta()
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()
请注意:某些版本的VLCJ不能与某些版本的libVLC一起使用.例如,VLCJ 1.2.x只能与libVLC 1.2.0(目前尚未发布-目前是每晚生成的版本)完美配合.如果将它与libVLC 1.1.x一起使用,它将无法通过MediaPlayer.getMediaMeta()
读取媒体文件元数据.在这种情况下,您需要为选择的VLCJ版本获取正确的libVLC库.
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.1.x相比,VLCJ 1.2.x进行了一些设计更改,这可能会使VLCJ的经验丰富的开发人员感到沮丧,但这是有充分理由的.
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.
这篇关于用Java获取视频文件元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!