我想获得有关视频的信息,所以我知道,mediainfo是不错的选择。我尝试使用它java。所以我在MediaInfo.java上填充了本地库mediainfo.s.0的包装器。我有ubitntu 16.04 64bit,库也是64位。我从filebot git项目获取代码并将本机库放在资源路径中。但我仍然得到错误。
Exception in thread "main" com.mediainfo.MediaInfoException: Unable to
load amd64 (64-bit) native library libmediainfo.so: Unable to load
library 'mediainfo': Native library (linux-x86-64/libmediainfo.so) not
found in resource path`
`Caused by: java.lang.UnsatisfiedLinkError: Unable to load library
'mediainfo': Native library (linux-x86-64/libmediainfo.so) not found in
resource path
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.mediainfo.MediaInfoLibrary.<clinit>(MediaInfoLibrary.java:23)
at com.mediainfo.MediaInfo.<init>(MediaInfo.java:22)
... 1 more
我将libmediainfo.so.0
和libzen.so.0
放在我系统的/usr/lib
目录中,然后检查。
解决了zen库的错误,但是mediainfo库的错误仍然存在。加载这些库的代码如下所示
Library LIB_ZEN = Platform.isLinux() ? (Library) Native.loadLibrary("zen", Library.class) : null;
MediaInfoLibrary INSTANCE = (MediaInfoLibrary) Native.loadLibrary("mediainfo", MediaInfoLibrary.class, singletonMap(OPTION_FUNCTION_MAPPER, new FunctionMapper() {
@Override
public String getFunctionName(NativeLibrary lib, Method method) {
// MediaInfo_New(), MediaInfo_Open() ...
return "MediaInfo_" + method.getName();
}
}));
所以我无法解决这个问题。我非常努力地解决这个问题。