I want to use ffmpeg via command line arguments in android application.For this purpose:
- I have cross-compiled the ffmpeg lib and got the libffmpeg.so
- I have stored libffmpeg.so in files directory of the app.
This is the code i am using:
public class MainActivity extends Activity {
Process p;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String[] cmd =new String[4];
cmd[0]="/data/data/com.example.ffmpegnew/files/libffmpeg";
cmd[1]="-i";
cmd[2]="mnt/sdcard/music/baba.mp4";
cmd[3]="mnt/sdcard/music/outfile.mp4";
p = Runtime.getRuntime().exec(cmd,null, new File("/data/data/com.example.ffmpegnew/files"));
}
catch(Exception e)
{
System.out.println("exception"+e);
}
}
}
This is the exception i am getting:
09-17 13:47:01.679: I/System.out(3752): exceptionjava.io.IOException: Error running exec(). Command: [/data/data/com.example.ffmpegnew/files/libffmpeg.so, -i, mnt/sdcard/music/baba.mp4, mnt/sdcard/music/outfile.mp4] Working Directory: /data/data/com.example.ffmpegnew/files Environment: null
Please tell me how to solve this problem.Thanks in advance.