genVideoThumbnail method

Future<void> genVideoThumbnail({
  1. required List<SrcDestType> pathList,
  2. int iconSize = 300,
  3. bool isOverride = false,
})

Implementation

Future<void> genVideoThumbnail({
  required List<SrcDestType> pathList,
  int iconSize = 300,
  bool isOverride = false,
}) async {
  try {
    for (final video in pathList) {
      final imageFile = File(video.dest);
      if (isOverride == false) {
        if (await imageFile.exists()) {
          continue;
        }
      }
      await Process.run('ffmpeg', [
        '-i', video.src,
        '-ss', '00:00:05', // Capture at 5 seconds
        '-vframes', '1',
        imageFile.path,
      ]);
    }
  } catch (e) {
    debugPrint("genVideoCover: ${e.toString()}");
  }
}