使用Galaxy S6 Edge设备使用FFMPEG4ANDROID时崩溃



我正在使用ffmpeg4android_lib在我的Android应用程序中压缩视频,它几乎在所有测试设备中都可以使用,但它在Galaxy S6 Edge和Galaxy S7 Edge中不起作用。

我的代码如下:

String inputFile = FileManager.getInstance().getRealPathFromVideoUri(context, video);
Log.i("INPUT FILE PATH", inputFile);
LoadJNI vk = new LoadJNI();
try {
        String workFolder = context.getApplicationContext().getFilesDir().getAbsolutePath();
        String outputFile = FileManager.getInstance().getFileFullName(ForSaleConstants.VIDEO_FOLDER,
        String.format(ForSaleConstants.VIDEO_NAME_FILE_FORMAT,      ForSaleConstants.VIDEO_NAME_FILE_NAME_PREFIX, System.currentTimeMillis()));
        String complexCommand[] = {
            "ffmpeg", "-y"
            , "-i", inputFile
            , "-strict", "experimental"
            , "-s", "320x240"
            , "-r", "25"
            , "-aspect", "4:3"
            , "-ab", "48000"
            , "-ac", "2"
            , "-vcodec", "mpeg4"
            , "-movflags", "+faststart"
            , "-ar", "22050"
            , "-b", "2097k"
            , outputFile};
            vk.run(complexCommand, workFolder, context.getApplicationContext());
            Log.i("OUTPUT FILE PATH", outputFile);
            return outputFile;
    } catch (Throwable e) {
        ForSaleServerManager.getInstance().logAndroidError("Couldn't compress video file");
        return null;
    }

崩溃如下:

nativeLibraryDirectories=[/data/app/com.forsale.forsale-1/lib/arm64, /data/app/com.forsale.forsale-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libloader-jni.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.netcompss.loader.LoadJNI.<clinit>(LoadJNI.java:13)

最新版本解决了此问题从这里下载:androidwarzone.blogspot.co.il/2011/12/ffmpeg4android.html?m=1

当我将以下行添加到build.gradle file

时解决了问题
ndk {
            abiFilter "armeabi-v7a"
        }

由于某种原因,它无法加载库文件,并且在添加上线时就解决了。

最新更新