输入路径中的Android ffmpeg空白导致“没有此类文件或目录", [英] Android ffmpeg white space in input path causing "no such file or directory"

查看:69
本文介绍了输入路径中的Android ffmpeg空白导致“没有此类文件或目录",的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新版本的 WritingMinds/ffmpeg-android-java 库.

I'm using the latest version of WritingMinds/ffmpeg-android-java library.

我尝试用单引号或双引号引用路径,但没有成功.

I've tried single/double quoting the path with no success.

我在执行后记录了命令,请查看子目录包含whiteSpace的输入路径,空格之间已添加逗号:

I Logged my command after execution, please look to the input path where a subDirectory contains whiteSpace, a comma has been added between the space:

ffmpeg, -i, "storage/emulated/0/Telegram/Telegram, Video/4_5828137322067002802.mp4", -vf...

我这样分割并运行命令:

I split and run my command like this:

String crop = "-ss " + skipTimeForCrop + " -noautorotate -i " + newPath + " -vframes 10 -vf cropdetect=24:16:0 -f null -";
String[] cropCommand = crop.trim().split(" ");
execFFmpegForCrop(cropCommand);

存储/仿真/0/电报/电报:没有这样的文件或目录

storage/emulated/0/Telegram/Telegram: No such file or directory

对此有任何想法吗?

推荐答案

我相信将命令添加为 List ,然后将其转换为数组将解决此问题,

I believe adding commands as List and then converting it to array will solve this problem,

这样,逗号只应添加到每个命令的末尾.我将向您展示如何:

This way the commas should only add to the end of every single commands. I'll show you how:

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, ...]";

这篇关于输入路径中的Android ffmpeg空白导致“没有此类文件或目录",的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆