Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling both JavaCV and FFmpegMediaMetadataRetriever #756

Closed
bibounet opened this issue Aug 4, 2017 · 7 comments
Closed

Compiling both JavaCV and FFmpegMediaMetadataRetriever #756

bibounet opened this issue Aug 4, 2017 · 7 comments
Labels

Comments

@bibounet
Copy link

bibounet commented Aug 4, 2017

hello,
I'm trying to use FFmpegMediaMetadataRetriever lib to get frames at precise position,
Once I add this lib to gradle, I need to add multiple 'pickFirst' to allow compilation.
this works, but now getting an error at runtime :

java.lang.UnsatisfiedLinkError: [...] couldn't find "libjniopencv_core.so"

gradle conf

    packagingOptions {
        pickFirst 'org/bytedeco/javacpp/macosx-x86_64/libusb-1.0.dylib'
        pickFirst 'lib/x86/libavcodec.so'
        pickFirst 'lib/x86/libavformat.so'
        pickFirst 'lib/x86/libavutil.so'
        pickFirst 'lib/x86/libswscale.so'
        pickFirst 'lib/armeabi/libavcodec.so'
        pickFirst 'lib/armeabi/libavformat.so'
        pickFirst 'lib/armeabi/libavutil.so'
        pickFirst 'lib/armeabi/libswscale.so'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
        pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
        pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
        pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
    }

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.3.3'
    compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11', classifier: 'android-arm'
    compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11', classifier: 'android-x86'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.6.1-0.11', classifier: 'android-arm'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.6.1-0.11', classifier: 'android-x86'

    compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'

    compile 'com.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support:design:25.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

if someone can help me, it will be the greatest day of my life :)

@saudet
Copy link
Member

saudet commented Aug 4, 2017 via email

@saudet saudet added the question label Aug 4, 2017
@saudet saudet closed this as completed Aug 4, 2017
@bibounet
Copy link
Author

bibounet commented Aug 7, 2017

Hello, thank you for your answer.

I added libjniopencv_core.so file (from .gradle[...].javacpp-presets\opencv[...]\opencv-3.2.0-1.3-android-x86.jar)** to

  • app\src\main\jniLibs\x86
  • app\src\main\jniLibs\armeabi

then compiling *.so in build gradle :
compile fileTree(dir: 'libs', include: ['*.jar', **'*.so'**])

but it's still missing... (even if I build a lib.jar file, into a lib or libs folder)

thank you for your support...

@saudet
Copy link
Member

saudet commented Aug 7, 2017

Really? Does it get removed if you add it to armeabi-v7a instead?

@bibounet
Copy link
Author

bibounet commented Aug 7, 2017

unfortunately yes :(

08-07 14:31:43.624 26721-26721/com.toto.optimon E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.toto.optimon, PID: 26721
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.toto.optimon-2/lib/arm/libjniopencv_core.so" has unexpected e_machine: 3
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:976)
at org.bytedeco.javacpp.Loader.load(Loader.java:777)
at org.bytedeco.javacpp.Loader.load(Loader.java:684)
at org.bytedeco.javacpp.opencv_core.(opencv_core.java:10)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at org.bytedeco.javacpp.Loader.load(Loader.java:739)
at org.bytedeco.javacpp.Loader.load(Loader.java:684)
....
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.toto.optimon-2/base.apk", zip file "/data/app/com.toto.optimon-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.toto.optimon-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.toto.optimon-2/lib/arm, /data/app/com.toto.optimon-2/base.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/com.toto.optimon-2/split_lib_slice_8_apk.apk!/

@saudet
Copy link
Member

saudet commented Aug 7, 2017

Well, this is an Android problem, but please let us know if you figure it out.

@saudet
Copy link
Member

saudet commented Aug 7, 2017

Also, these kinds of issues are usually fixed by ReLinker, so make sure to use that:
https://github.com/bytedeco/javacpp-presets/wiki/The-UnsatisfiedLinkError-X-File-%28a-real-experience%29

@bibounet
Copy link
Author

It was my mistake sorry, I was extracting opencv-3.2.0-1.3-android-x86.jar and not opencv-3.2.0-1.3-android-arm.jar to app/src/main/jniLibs/{arm, armeabi, armeabi-v7a}

So now it works!
Thanks again for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants