android - 输入路径中的Android ffmpeg空白导致“没有这样的文件或目录”
问题描述
我正在使用最新版本的WritingMinds/ffmpeg-android-java库。
我试过单/双引用路径但没有成功。
我在执行后记录了我的命令,请查看子目录包含空格的输入路径,空格之间添加了逗号:
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);
storage/emulated/0/Telegram/Telegram: 没有这样的文件或目录
对此有任何想法吗?
解决方案
我相信添加命令 asList
然后将其转换为数组将解决这个问题,
这样,逗号应该只添加到每个命令的末尾。我会告诉你如何:
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, ...]";
推荐阅读
- powershell - 如何将命令行参数设为整数但如果给定非数字值再次询问?
- c# - C#在窗口之间传递数据(WPF)
- javascript - 在每行的第一个元素上设置边框
- sql-server - SQL Azure 中的 Active Directory 身份验证和延迟问题
- c# - PostAsync 执行后立即从继承的地方返回
- excel - Excel VBA - 验证列中的电子邮件地址并复制到剪贴板
- javascript - 如果需要,如何创建一个可以导入单个组件的库 à la lodash
- nginx - Nginx 入口控制器不会通过重定向保留 url
- angular - 无法使用 Angular CLI 创建新项目
- google-cloud-dataflow - 如何获取通过数据流运行的查询的 BigQuery 作业 ID?