Reputation: 225
I am using ffmpeg to cut video via android, all working fine but only issue come when if the source directory contain space the command is not working by saying file not found
-i /storage/emulated/0/ISave Videos/Br0gv9anKKg.mp4 -acodec copy -vcodec copy -ss 00:00:10 -t 00:00:20 /storage/emulated/0/1547813275685ChunkClip.mp4
file not found is Like"File not found -i /storage/emulated/0/ISave"
But for other path no issue and all works fine only if space is there in file path the issue comes
Upvotes: 1
Views: 657
Reputation: 7164
Cool Question
Its very confusing to solve there type of issues even if we get a solution The following Link show some fix for handling issues like this Quoting and escaping
So for the issue you have there is fix Add each word in ffmpeg comments to an LinkedList and then convert to command array so that ffmpeg will execute it
As follows (As per you requirement command)
List<String> cmdList = new LinkedList<>();
cmdList.add("-i");
cmdList.add("/storage/emulated/0/ISave Videos/Br0gv9anKKg.mp4");
cmdList.add("-acodec");
cmdList.add("copy");
cmdList.add("-vcodec");
cmdList.add("copy");
cmdList.add("-ss");
cmdList.add("00:00:10");
cmdList.add("-t");
cmdList.add("00:00:20");
cmdList.add("/storage/emulated/0/1547813275685ChunkClip.mp4");
String[] command = cmdList.toArray(new String[cmdList.size()]);
Hope your issue will be get resolved by this solution
Upvotes: 3