我使用的是最新版本的WritingMinds/ffmpeg-android-java库。
我尝试了单引号/双引号路径,但没有成功。
我在执行后记录了我的命令,请查看包含whiteSpace的subDirectory的输入路径,空格之间添加了一个逗号:
ffmpeg, -i, "storage/emulated/0/Telegram/Telegram, Video/4_5828137322067002802.mp4", -vf...
我像这样拆分并运行我的命令:
String crop = "-ss " + skipTimeForCrop + " -noautorotate -i " + newPath + " -vframes 10 -vf cropdetect=24:16:0 -f null -";
String[] cropCommand = crop.trim().split(" ");
execFFmpegForCrop(cropCommand);
存储/仿真/0/电报/电报:没有这样的文件或目录
对此有什么想法吗?
发布于 2018-07-30 21:11:52
我相信将命令添加为List
,然后将其转换为数组可以解决这个问题,
这样,逗号应该只添加到每个命令的末尾。我将向您展示如何:
List<String> commandList = new LinkedList<>();
commandList.add("-ss");
commandList.add("00:00:00");
commandList.add("-noautorotate");
commandList.add("-i");
commandList.add("storage/emulated/0/Telegram/Telegram Video/4_5828137322067002802.mp4");
commandList.add("-vframes");
commandList.add("10");
commandList.add("-vf");
commandList.add("-cropdetect=24:16:0");
.
.
.
String[] cropCommand = commandList.toArray(new String[commandList.size()]);
execFFmpegForCrop(cropCommand);
这将是输出:
"[-ss, 00:00:00, -noautorotate, -i, storage/emulated/0/Telegram/Telegram Video/4_5828137322067002802.mp4, -vframes, 10, -vf, -cropdetect=24:16:0, ...]";
发布于 2018-11-21 12:29:50
因为您使用的是String[] cropCommand = crop.trim().split(" ");
命令,所以这将减少包含空白“”的文件名,并且输入文件将失败
发布于 2018-07-29 01:28:59
尝试在空格前使用双反斜杠:"storage/emulated/0/Telegram/Telegram,\\ Video/4_5828137322067002802.mp4"
https://stackoverflow.com/questions/51573542
复制相似问题