我创建了一个从视频中捕获帧的类。当它捕获一个帧时,它被保存为图片。当视频是.avi时,应用程序运行正常。格式为.avi。
时public static void main(String[] args) {
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("C:/Users/Ioanna/Desktop/video1.avi");
try {
IplImage img;
//Start grabber to capture video
grabber.start();
//grab video frame to IplImage
img = grabber.grab();
if (img != null) {
//save video frame as a picture
cvSaveImage("capture.jpg", img);
}
}catch (Exception e) {
}
}
错误是
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.googlecode.javacv.FFmpegFrameGrabber.<init>(FFmpegFrameGrabber.java:106)
at Video.main(Video.java:75)
Caused by: java.lang.IllegalStateException: Can't overwrite cause with java.lang.UnsatisfiedLinkError: no avcodec in java.library.path
at java.lang.Throwable.initCause(Throwable.java:457)
at com.googlecode.javacpp.Loader.load(Loader.java:581)
at com.googlecode.javacpp.Loader.load(Loader.java:532)
at com.googlecode.javacv.cpp.avcodec.<clinit>(avcodec.java:39)
... 2 more
Caused by: java.lang.UnsatisfiedLinkError: no jniavcodec in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1837)
有谁知道这是什么问题?
提前致谢
答案 0 :(得分:3)
在网上搜索了一段时间之后,我找到了以下解决方案:
第1步:从中下载.zip文件“javacv-0.6- cppjars .zip” https://code.google.com/p/javacv/downloads/list并解压缩。
第2步:将“ffmpeg-20130915-git-7ac6c63-windows-x86_64.jar”文件添加到Java项目中!