I create a class that capture frame from a video. When it capture a frame, it's saved as a picture. When the video is .avi, application works ok. When format is .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) {
}
}
The error is
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)
Do anyone know what is the problem?
Thanks in advance
After searching the web for quite some time, I came to the following solution:
Step 1: Download the .zip file "javacv-0.6-cppjars.zip" from
https://code.google.com/p/javacv/downloads/list and unzip it.
Step 2: Add "ffmpeg-20130915-git-7ac6c63-windows-x86_64.jar" file to your Java project!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With