buildFfmpegCommand method

String buildFfmpegCommand(
  1. List<String> imagePaths
)

Implementation

String buildFfmpegCommand(List<String> imagePaths) {
  // Create an input command string using the provided images
  String inputs = '';
  for (int i = 0; i < imagePaths.length; i++) {
    inputs += '-loop 1 -t 1 -i ${imagePaths[i]} ';
  }

  // Command to combine images and create a video
  String command = '$inputs -filter_complex "concat=n=${imagePaths.length}:v=1:a=0" ${imagePaths[0].replaceFirst(RegExp(r'frame_\d+\.png'), 'output.mp4')}';
  return command;
}