我正在使用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)
答案 0 :(得分:0)
最新版本解决了这个问题 从这里下载: androidwarzone.blogspot.co.il/2011/12/ffmpeg4android.html?m=1
答案 1 :(得分:0)
当我将以下行添加到build.gradle文件
时,问题解决了Table A
IdA : 1
name : Bananas
Table B
idB : 1
name : I
A_id : 1
idB : 2
name : K
A_id : 1
idB : 3
name : D
A_id : 1
由于某种原因,它无法加载库文件,并在添加上一行时解决了。