I want to execute ffmpeg from an Android app, very much as described here: Using FFmpeg with Android-NDK.
Executing the following commands work fine:
Process p = Runtime.getRuntime().exec("/data/data/yourpackagename/ffmpeg -i infile.mp4 outfile.mp4");
or
Process p = Runtime.getRuntime().exec(new String[]{"/data/data/yourpackagename/ffmpeg", "-i", "infile.mp4", "outfile.mp4");
But when the input or output filenames contain spaces ffmpeg fails with a "File not found" error:
Process p = Runtime.getRuntime().exec("/data/data/yourpackagename/ffmpeg -i \"in space file.mp4\" outfile.mp4"); // fails
Process p = Runtime.getRuntime().exec("/data/data/yourpackagename/ffmpeg -i 'in space file.mp4' outfile.mp4"); // fails
Process p = Runtime.getRuntime().exec(new String[]{"/data/data/yourpackagename/ffmpeg", "-i", "\"in space file.mp4\"", "outfile.mp4"); //fails
FFMPEG also fails for files without spaces but quoted:
Process p = Runtime.getRuntime().exec("/data/data/yourpackagename/ffmpeg -i \"infile.mp4\" outfile.mp4"); // fails
How can I correctly pass a filename containing spaces to the ffmpeg command?
Regards,