I know there is a lot of similiar questions to this, but a lot of them seem to be out of date because of the development of libraries such JavaCV.
I used the code from Video Creation with Images and Audio in Android to create movie, but I have a problem with lib imports.
I did as JavaCV page says, I put dependency in gradle :
compile group: 'org.bytedeco', name: 'javacv', version: '0.9'
now, I don't know if I have to do something else?
I have used these imports :
import org.bytedeco.javacpp.avcodec;
import org.bytedeco.javacpp.opencv_core.IplImage;
import org.bytedeco.javacv.FFmpegFrameRecorder;
import static org.bytedeco.javacpp.opencv_highgui.cvLoadImage;
and get this error :
Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
at org.bytedeco.javacpp.Loader.load(Loader.java:387)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.avformat.(avformat.java:13)
at org.bytedeco.javacv.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:106)
at voidstudio.app.activity.CreateMovieTask.doInBackground(CreateMovieTask.java:46)
at voidstudio.app.activity.CreateMovieTask.doInBackground(CreateMovieTask.java:21)
and
Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:217)
and
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load jniavutil from loader dalvik.system.PathClassLoader[dexPath=/data/app/voidstudio.app-1.apk,libraryPath=/data/app-lib/voidstudio.app-1]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:521)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
at org.bytedeco.javacpp.Loader.load(Loader.java:410)
did I missed sth in configuration? I have seen similiar questions but there was no proper answer for this.
解决方案
Update! I've also found out that if you have have an armeabi-v7a folder in the jniLibs, or are using anything other than an armeabi folder, you will have issues with the .so files not being added.
Looks like ffmpeg is not being imported. I had the same problem. Here is what I did. Let me know if this helps you!
compile group: 'org.bytedeco', name: 'javacv', version: '0.9'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.9-0.9', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.3-0.9', classifier: 'android-arm'