Skip to content Skip to sidebar Skip to footer

Android: Ffmpeg With Filenames Containing Spaces

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

Solution 1:

Wild guess , but you may want the java process to pass "\ " read "backslash space" to the underlying OS when you want ffmpeg to open a file with a name containing a space.

Its not what the java does with the string fileName. Its what the underlying OS and ffmpeg process receives that it will use as 'filename'. There you want "foo bar.input" to be

"foo\ bar.input"

So, the underlying expression "ffmpeg -i foo\ bar.input" should work.

you just need to figure out how to construct your java strings so that the process feeds the above expression to the NDK / process layer running the "ffmpeg" command.

more here


Solution 2:

I finally got it. I forgot one possibility, and exactly this one is working:

Process p = Runtime.getRuntime().exec(new String[]{"/data/data/yourpackagename/ffmpeg", "-i", "in space file.mp4", "outfile.mp4"); //OK

Post a Comment for "Android: Ffmpeg With Filenames Containing Spaces"