convert static method

File convert({
  1. required File audioInput,
  2. required File audioOutput,
  3. String? pathFFmpeg,
  4. FFmpegArgs? fFmpegArgs,
  5. String? workingDirectory,
  6. Map<String, String>? environment,
  7. bool includeParentEnvironment = true,
  8. bool runInShell = false,
  9. Duration? timeout,
})

Implementation

static File convert({
  required File audioInput,
  required File audioOutput,
  String? pathFFmpeg,
  FFmpegArgs? fFmpegArgs,
  String? workingDirectory,
  Map<String, String>? environment,
  bool includeParentEnvironment = true,
  bool runInShell = false,
  Duration? timeout,
}) {
  timeout ??= Duration(seconds: 10);
  DateTime time_expire = DateTime.now().add(timeout);
  var res = FFmpeg(pathFFmpeg: pathFFmpeg).convertAudioToWavWhisper(
    pathAudioInput: audioInput.path,
    pathAudioOutput: audioOutput.path,
    pathFFmpeg: pathFFmpeg,
    fFmpegArgs: fFmpegArgs,
    workingDirectory: workingDirectory,
    environment: environment,
    runInShell: runInShell,
  );
  while (true) {
    if (DateTime.now().isAfter(time_expire)) {
      throw "time out";
    }
    if (res) {
      if (audioOutput.existsSync()) {
        return audioOutput;
      }
    } else {
      if (!audioInput.existsSync()) {
        throw "audio input not found";
      }
    }
  }
}