![Ffmpeg 中的 Flutter 错误,“未处理的异常:ProcessException:没有这样的文件或目录”在 macOS 桌面版中](https://linux22.com/image/1705817/Ffmpeg%20%E4%B8%AD%E7%9A%84%20Flutter%20%E9%94%99%E8%AF%AF%EF%BC%8C%E2%80%9C%E6%9C%AA%E5%A4%84%E7%90%86%E7%9A%84%E5%BC%82%E5%B8%B8%EF%BC%9AProcessException%EF%BC%9A%E6%B2%A1%E6%9C%89%E8%BF%99%E6%A0%B7%E7%9A%84%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95%E2%80%9D%E5%9C%A8%20macOS%20%E6%A1%8C%E9%9D%A2%E7%89%88%E4%B8%AD.png)
我正在尝试使用 ffmpeg 为 macOS 桌面应用程序修剪视频。
我已经从这里适用于 macOS。
这是我的代码
String mainPath = 'Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/';
mainPath = mainPath.substring(0, mainPath.lastIndexOf("/"));
Directory directoryExe3 = Directory("$mainPath");
var dbPath = path.join(directoryExe3.path,
"App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos");
//here in "Products/Debug/" folder desktop app will generate
//directoryExe3 path will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug
//and dbPath will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos
//so when app will run it can access it from this path
//executable code, command for ffmpeg
String transpose_str += "crop=" +
out_w.toInt().toString() +
":" +
out_h.toInt().toString() +
":" +
x!.toInt().toString() +
":" +
y!.toInt().toString() +
",";
transpose_str += "scale=960:192";
Future<ProcessResult> result_ = Process.run(dbPath, [
"-ss",
timestamp,
"-i",
inputFilePath,
"-t",
endTime,
"-vf",
transpose_str,
"-an",
"./temp.mp4",
]);
现在,当我在 macOS 桌面版本中运行它时,它会在 Process.run 中给我一个错误,在 dbPath 中,未处理的异常:ProcessException:没有这样的文件或目录。
任何帮助都将不胜感激!