gpt4 book ai didi

android - 在 Android 应用程序中为 FFMPEG 运行 exec() 时出错

转载 作者:行者123 更新时间:2023-12-04 23:16:34 30 4
gpt4 key购买 nike

遵循本教程:https://github.com/cine-io/android-ffmpeg-with-rtmp 并在 Ubuntu 14.04 64 位中成功编译后,尝试执行 ffmpeg 时出现 IOException:

String abspath = getApplicationInfo().nativeLibraryDir;

// Change the permissions
try {
Runtime.getRuntime().exec("chmod -R 777 "+ abspath).waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

String cameraPath = "/storage/emulated/0/DCIM/Camera/";
String cmd = "ffmpeg -i "+ cameraPath + "VID_20150728_150045662.mp4 -y "+ cameraPath + "output.mp4";

ProcessBuilder processBuilder = new ProcessBuilder(cmd);

final Map<String, String> environment = processBuilder.environment();

environment.put("LD_LIBRARY_PATH", getDir("lib", 0).getAbsolutePath());

try {
Process process = processBuilder.start();
} catch (IOException e) {
e.printStackTrace();
}

IOException 是:

Error running exec(). Command: [ffmpeg -i /storage/emulated/0/DCIM/Camera/VID_20150728_150045662.mp4 -y /storage/emulated/0/DCIM/Camera/output.mp4] Working Directory: null Environment: [ANDROID_ROOT=/system, EMULATED_STORAGE_SOURCE=/mnt/shell/emulated, LOOP_MOUNTPOINT=/mnt/obb, EMULATED_STORAGE_TARGET=/storage/emulated, ANDROID_BOOTLOGO=1, LD_LIBRARY_PATH=/data/data/douglasanunciacao.ndksample/app_lib, EXTERNAL_STORAGE=/storage/emulated/legacy, ANDROID_SOCKET_zygote=11, ANDROID_DATA=/data, PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin, ANDROID_ASSETS=/system/app, ASEC_MOUNTPOINT=/mnt/asec, BOOTCLASSPATH=/system/framework/core.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/webviewchromium.jar:/system/framework/telephony-msim.jar:/system/framework/oem-services.jar:/system/framework/qcmediaplayer.jar, ANDROID_PROPERTY_WORKSPACE=9,0, ANDROID_STORAGE=/storage]



有谁知道这个问题的解决方案?

最佳答案

您可能需要将 ffmpeg 的完全限定路径放入命令中。

如果它在文件夹 /data/data/douglasanunciacao.ndksample/app_lib 中,那么 String cmd = "/data/data/douglasanunciacao.ndksample/app_lib/ffmpeg -i "+ cameraPath + "VID_20150728_150045662.mp4 -y "+ cameraPath + "output.mp4";

关于android - 在 Android 应用程序中为 FFMPEG 运行 exec() 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31684313/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com