magiclen / FFmpeg-CLI-For-Android

Now, you can edit audios and videos by using Command Line Interface for FFmpeg.
https://magiclen.org/ffmpeg-android/
24 stars 7 forks source link

Process.start err #4

Closed aikongmeng closed 8 years ago

aikongmeng commented 8 years ago

參考了這個文章

File fileBinDir = new File(activity.getFilesDir().getParentFile(), "lib"); //FFmpeg執行檔的所在目錄
File fileBin = new File(fileBinDir, "libffmpeg.so"); //FFmpeg執行檔的檔案路徑
ProcessBuilder pb = new ProcessBuilder(cmds); //cmds為Command Line的指令,例如某行指令為:「libffmpeg.so -h」cmds的List內容就是["libffmpeg.so","-h"]
pb.directory(fileBinDir); //將工作目錄移到FFmpeg執行檔的所在目錄,不過還是建議在cmds中以絕對路徑來表示libffmpeg.so
pb.redirectErrorStream(true); //將FFmpeg的標準輸出和錯誤輸出合併成同一個inputStream
Process process = pb.start(); //執行行程

不知道為何在執行

pb.start();

時候報錯. 錯誤信息如下:

java.io.IOException: Error running exec(). Command: [ffmpeg, -version] Working Directory: /data/data/com.example.magiclen/lib Environment: [EXTERNAL_ADD_USB_STORAGE4=/storage/USBstorage4, EXTERNAL_ADD_USB_STORAGE2=/storage/USBstorage2, EMULATED_STORAGE_TARGET=/storage/emulated, EXTERNAL_ADD_USB_STORAGE6=/storage/USBstorage6, EXTERNAL_ADD_USB_STORAGE3=/storage/USBstorage3, PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin, ANDROID_DATA=/data, EXTERNAL_ADD_USB_STORAGE5=/storage/USBstorage5, BOOTCLASSPATH=/system/framework/WfdCommon.jar:/system/framework/aspectjrt.jar:/system/framework/com.lge.frameworks.jar:/system/framework/com.lge.policy.jar:/system/framework/telephony-target.jar:/system/framework/com.lge.opt.jar:/system/framework/bc-fips.jar:/system/framework/tcmiface.jar:/system/framework/core-libart.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/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/apache-xml.jar, SECONDARY_STORAGE=/storage/external_SD, ANDROID_STORAGE=/storage, EXTERNAL_ADD_USB_STORAGE1=/storage/USBstorage1, ANDROID_ROOT=/system, EMULATED_STORAGE_SOURCE=/mnt/shell/emulated, LOOP_MOUNTPOINT=/mnt/obb, LD_PRELOAD=libsigchain.so:libNimsWrap.so, ANDROID_BOOTLOGO=1, EXTERNAL_STORAGE=/storage/emulated/legacy, SYSTEMSERVERCLASSPATH=/system/framework/com.lge.services.jar:/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar, ANDROID_ASSETS=/system/app, ASEC_MOUNTPOINT=/mnt/asec, EXTERNAL_ADD_STORAGE=/storage/external_SD, ANDROID_SOCKET_zygote_secondary=12, ANDROID_PROPERTY_WORKSPACE=10,0]
magiclen commented 8 years ago

Duplicate issue: https://github.com/magiclen/FFmpeg-CLI-For-Android/issues/3.