I use the ffmpeg_kit_flutter which take a list of image and make a video and i am not be able to run my app.
Future<void> createVideoFromImages(List<Uint8List> images) async {
final tempDir = await getTemporaryDirectory();
final videoPath = '${tempDir.path}/output_${DateTime.now().millisecondsSinceEpoch}.mp4';
final imagePaths = <String>[];
for (int i = 0; i < images.length; i++) {
final imagePath = '${tempDir.path}/image$i.png';
await File(imagePath).writeAsBytes(images[i]);
imagePaths.add(imagePath);
}
final ffmpegCommand = [
'-framerate', '7',
'-i', '${tempDir.path}/image%d.png',
'-c:v', 'libx264',
'-pix_fmt', 'yuv420p',
videoPath,
];
final session = await FFmpegKit.executeWithArguments(ffmpegCommand);
final logs = await session.getLogs(); // Get the logs
for (final log in logs) {
print(log.getMessage()); // Print each log message
}
if (ReturnCode.isSuccess(await session.getReturnCode())) {
await GallerySaver.saveVideo(videoPath);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Video saved to gallery'),
),
);
} else {
print('Error: Video creation failed');
}
}
I think the error is in the package
The error log:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.arthenica.ffmpegkit.Abi found in modules jetified-ffmpeg-kit-https-6.0-runtime (com.arthenica:ffmpeg-kit-https:6.0) and jetified-ffmpeg-kit-https-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-https-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.AbiDetect found in modules jetified-ffmpeg-kit-https-6.0-runtime (com.arthenica:ffmpeg-kit-https:6.0) and jetified-ffmpeg-kit-https-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-https-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.AbstractSession found in modules jetified-ffmpeg-kit-https-6.0-runtime (com.arthenica:ffmpeg-kit-https:6.0) and jetified-ffmpeg-kit-https-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-https-gpl:5.1)
How can I handle this error?