0

I am executing commands through process but it always throw this error anyone help me ?

FFMPEGCommand:

 String[] ffmpegCommand = {"/data/data/com.example.app/ffmpeg", "-r", ""+VIDEO_FRAME_RATE, "-b", "1000", "-vcodec", "mjpeg", "-i", Environment.getExternalStorageDirectory().getPath() + "/com.example.app/frame_%05d.jpg", Environment.getExternalStorageDirectory().getPath() + "/video.mov"}; ffmpegProcess = new ProcessBuilder(ffmpegCommand).redirectErrorStream(true).start(); W/System.err(29844): java.io.IOException: Error running exec(). Command: [/data/data/com.example.app/ffmpeg, -r, 18, -b, 1000, -vcodec, mjpeg, -i, /storage/emulated/0/com.example.app/frame_%05d.jpg, /storage/emulated/0/video.mov] 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=/vendor/lib:/system/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/oem-services.jar:/system/framework/qcmediaplayer.jar, ANDROID_PROPERTY_WORKSPACE=9,0, ANDROID_STORAGE=/storage] 06-02 12:21:36.660: W/System.err(29844): at java.lang.ProcessManager.exec(ProcessManager.java:211) 06-02 12:21:36.660: W/System.err(29844): at java.lang.ProcessBuilder.start(ProcessBuilder.java:195) 06-02 12:21:36.662: W/System.err(29844): at com.example.app.FFMPEGRecorderActivity$ProcessVideo.doInBackground(FFMPEGRecorderActivity.java:1448) 06-02 12:21:36.662: W/System.err(29844): at com.example.app.FFMPEGRecorderActivity$ProcessVideo.doInBackground(FFMPEGRecorderActivity.java:1) 06-02 12:21:36.662: W/System.err(29844): at android.os.AsyncTask$2.call(AsyncTask.java:288) 06-02 12:21:36.663: W/System.err(29844): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 06-02 12:21:36.663: W/System.err(29844): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 06-02 12:21:36.663: W/System.err(29844): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 06-02 12:21:36.663: W/System.err(29844): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 06-02 12:21:36.663: W/System.err(29844): at java.lang.Thread.run(Thread.java:841) 06-02 12:21:36.664: W/System.err(29844): Caused by: java.io.IOException: No such file or directory 06-02 12:21:36.665: W/System.err(29844): at java.lang.ProcessManager.exec(Native Method) 06-02 12:21:36.666: W/System.err(29844): at java.lang.ProcessManager.exec(ProcessManager.java:209) 06-02 12:21:36.667: W/System.err(29844): ... 9 more 
1
  • What is the actual ffmpeg console/log output resulting from the ffmpeg command? Commented Jun 2, 2014 at 15:34

2 Answers 2

1

From quick look at your error, there is null instead of full path to the input file for ffmpeg.

So, replace

 Environment.getExternalStorageDirectory().getPath() + "/com.example.app/frame_%05d.jpg" 

with follow pseudo code.

get a File instance on the input jpg.

 myInputJpg.getAbsolutePath() 

may provide a non-null ffmpeg file handle for the input...

Sign up to request clarification or add additional context in comments.

2 Comments

PS you should see stuff in the logcat about the native library being loaded. Thats the wrapper for the ffmpeg native stuff.
Thanks for the answer. Yes your concern is correct but I have fixed it with the answer below.
0

Its been fixed while I have re-execute the .so files and makes path like this:

String[] ffmpegCommand = {"/data/data/com.example.app/ffmpeg", "-r", ""+VIDEO_FRAME_RATE, "-vcodec", "mjpeg", "-i", Environment.getExternalStorageDirectory().getPath() + "/com.example.app/frame_%105d.jpg", Environment.getExternalStorageDirectory().getPath() + "/com.example.app/video.mov"}; ProcessBuilder builder = new ProcessBuilder(ffmpegCommand); Map<String, String> env = builder.environment(); env.put("LD_LIBRARY_PATH", "/data/data/com.example.app:$LD_LIBRARY_PATH"); ffmpegProcess = builder.redirectErrorStream(true).start(); OutputStream ffmpegOutStream = ffmpegProcess.getOutputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(ffmpegProcess.getInputStream())); String line; Log.v("ss","***Starting FFMPEG***"); while ((line = reader.readLine()) != null) { Log.v("asd","***"+line+"***"); } Log.v("asdas","***Ending FFMPEG***"); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.