Ffmpeg 中的 Flutter 错误,“未处理的异常:ProcessException:没有这样的文件或目录”在 macOS 桌面版中

Ffmpeg 中的 Flutter 错误,“未处理的异常:ProcessException:没有这样的文件或目录”在 macOS 桌面版中

我正在尝试使用 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:没有这样的文件或目录。

任何帮助都将不胜感激!

相关内容