I'm trying to convert a file to a list of image file. Ideally with an option to extract a frame every X milliseconds.
Do you know if it possible to do so with flutter using ffmpeg?
Been trying with export_video_frame plugin but it is very slow and not stable.
CodePudding user response:
Try the below snippet:
String command = "-i ${videoFilePath} -r $imagesCount -f image2 ${outputPath}image-=.png"
FFmpegKit.execute(command).then((session) async {
final returnCode = await session.getReturnCode();
if (ReturnCode.isSuccess(returnCode)) {
print("Success!!!!");
} else {
print("Failed!!!!");
}
}
);
Replace videoFilePath
with the input file path and outputPath
with the directory path where you want to save the images. Also, the imagesCount
with how many images you want per frame.