我想获取有关视频的信息,所以我知道 mediainfo 是不错的选择。我尝试使用它java。因此,我将 MediaInfo.java 定义为原生库 mediainfo.s.0 的包装器,我有 ubuntu 16.04 64 位,并且该库也是 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();
}
}));
所以我无法解决这个问题。我非常努力地解决这个问题。