export static method

Future<bool> export(
  1. List<TextLayer> textLayers,
  2. int? fps,
  3. String input,
  4. String output,
  5. Map<String, FontFile> fonts,
)

Implementation

static Future<bool> export(
  List<TextLayer> textLayers,
  int? fps,
  String input,
  String output,
  Map<String, FontFile> fonts,
) async {
  final cmd = <String>['-i', '"$input"'];

  if (fps != null) cmd.addAll(['-r', '$fps']);

  if (textLayers.length > 1) {
    cmd.addAll([
      '-filter_complex',
      '"${[for (final e in textLayers) await getCMD(e, fonts)].join(',')}"'
    ]);
  } else {
    cmd.addAll(['-vf', '"${await getCMD(textLayers.first, fonts)}"']);
  }

  cmd.addAll(['-c:a', 'copy', '"$output"', '-y']);

  return ffmpeg.execute(cmd);
}