build method

FfmpegCommand build({
  1. String? ffmpegPath,
  2. required List<CliArg> args,
  3. FfmpegStream? mainOutStream,
  4. required String outputFilepath,
})

Accumulates all the input assets and filter chains in this builder and returns an FfmpegCommand that generates a corresponding video, which is rendered to the given outputFilepath.

Provide a ffmpegPath to customize the path of the ffmpeg cli. For example, ffmpegPath might be /opt/homebrew/bin/ffmpeg on macOS or C:\ffmpeg\ffmpeg.exe on Windows. If null, the ffmpeg from path is used.

To run the command, see FfmpegCommand.

Implementation

FfmpegCommand build({
  String? ffmpegPath,
  required List<CliArg> args,
  FfmpegStream? mainOutStream,
  required String outputFilepath,
}) {
  ffmpegBuilderLog.info('Building command. Filter chains:');
  for (final chain in _filterChains) {
    ffmpegBuilderLog.info(' - ${chain.toCli()}');
  }

  ffmpegBuilderLog.info('Filter chains: $_filterChains');
  return FfmpegCommand.complex(
    ffmpegPath: ffmpegPath,
    inputs: _inputs.keys.toList(),
    args: args,
    filterGraph: FilterGraph(
      chains: _filterChains,
    ),
    outputFilepath: outputFilepath,
  );
}