Java normalize file path for external execution-Collection of common programming errors
Instead of using exec(String), use exec(String[]) (from Runtime). The second form lets you supply all arguments individually, that way Java does not need to parse them further, and will not split on spaces.
Example:
Process proc = Runtime.getRuntime().exec(
new String[]{"ffmpeg", "-ac", "1", "-i",videoFile.getPath()), audioFile.getPath()}
);
You should always use the second form if your arguments may contain spaces, otherwise your command may break.