invoke method

Future<FFmpegRawResponse> invoke({
  1. String? pathFFmpeg,
  2. FFmpegArgs? fFmpegArgs,
  3. String? workingDirectory,
  4. Map<String, String>? environment,
  5. bool includeParentEnvironment = true,
  6. bool runInShell = false,
})

Implementation

Future<FFmpegRawResponse> invoke({
  String? pathFFmpeg,
  FFmpegArgs? fFmpegArgs,
  String? workingDirectory,
  Map<String, String>? environment,
  bool includeParentEnvironment = true,
  bool runInShell = false,
}) async {
  fFmpegArgs ??= FFmpegArgs([]);
  pathFFmpeg ??= path_ffmpeg;
  ProcessResult res = await Process.run(
    pathFFmpeg,
    fFmpegArgs.toList(),
    workingDirectory: workingDirectory,
    environment: environment,
    includeParentEnvironment: includeParentEnvironment,
    runInShell: runInShell,
  );
  if (res.exitCode == 0) {
    return FFmpegRawResponse(
      rawData: {"@type": "ok", "message": res.stdout},
      processResult: res,
    );
  } else {
    return FFmpegRawResponse(
      rawData: {"@type": "error", "message": res.stderr},
      processResult: res,
    );
  }
}