bytedeco / javacpp-presets

The missing Java distribution of native C++ libraries
Other
2.68k stars 744 forks source link

How to rely on the org.bytedeco:ffmpeg library in Android development #1488

Closed Sidnio closed 8 months ago

Sidnio commented 8 months ago
   implementation("org.bytedeco:ffmpeg:6.1.1-1.5.10")
//    implementation(group="org.bytedeco", name="ffmpeg", version="6.1.1-1.5.10", classifier= "android-arm64")
//    implementation(group = "org.bytedeco", name = "ffmpeg", version = "6.1.1-1.5.10", classifier = "android-x86_64")
//
//    implementation("org.bytedeco:javacpp:1.5.10")
//    implementation(group="org.bytedeco", name="javacpp", version="1.5.10", classifier= "android-arm64")
//    implementation(group = "org.bytedeco", name = "javacpp", version = "1.5.10", classifier = "android-x86_64")
java.lang.UnsatisfiedLinkError: dlopen failed: library "libjniavutil.so" not found
                                            at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
                                            at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
                                            at java.lang.System.loadLibrary(System.java:1664)
                                            at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1832)
                                            at org.bytedeco.javacpp.Loader.load(Loader.java:1423)
                                            at org.bytedeco.javacpp.Loader.load(Loader.java:1234)
                                            at org.bytedeco.javacpp.Loader.load(Loader.java:1210)
                                            at org.bytedeco.ffmpeg.global.avutil.<clinit>(avutil.java:14)
                                            at java.lang.Class.classForName(Native Method)
                                            at java.lang.Class.forName(Class.java:454)
                                            at org.bytedeco.javacpp.Loader.load(Loader.java:1289)
                                            at org.bytedeco.javacpp.Loader.load(Loader.java:1234)
                                            at org.bytedeco.javacpp.Loader.load(Loader.java:122
```6)
val ffmpeg: String = Loader.load(ffmpeg::class.java)
        val pb = ProcessBuilder(ffmpeg, "-i", media.url, "-c", "copy", ExternalStorageManager.SHIXUN_DOWNLOAD)

        val start = pb.inheritIO().start()
saudet commented 8 months ago

There's a working sample project here: https://github.com/bytedeco/sample-projects/tree/master/JavaCV-android-example