genVideoCoverList method
Implementation
Future<void> genVideoCoverList({
required List<String> videoPathList,
required String outDirPath,
int iconSize = 300,
}) async {
try {
for (final videoPath in videoPathList) {
final name = videoPath.split('/').last;
final outputPath = '$outDirPath/${name.split('.').first}.png';
final outImageFile = File(outputPath);
if (await outImageFile.exists()) {
continue;
}
await Process.run('ffmpeg', [
'-i', videoPath,
'-ss', '00:00:05', // Capture at 5 seconds
'-vframes', '1',
outImageFile.path,
]);
}
} catch (e) {
debugPrint("genVideoCover: ${e.toString()}");
}
}