Javacv uses ffmpeg to capture frames
•
Java
I created a class to capture frames from video When a frame is captured, it is saved as a picture When the video is When avi, the application runs normally The 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 mistake 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)
Who knows what the problem is?
Thank you in advance
Solution
After searching the Internet for some time, I found the following solutions:
Step 1: from Download the zip file "javacv-0.6-cppjars. Zip" https://code.google.com/p/javacv/downloads/list And decompress
Step 2: add the "ffmpeg-20130915-git-7ac6c63-windows-x86_64. Jar" file to the Java project!
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码