i'm trying to make gif with video file.
just one - two seconds gif like Tiktok thumnail
but I don't know how to do it
I tryed many things but didn't make it
Image Package
https://pub.dev/packages/image
Variable FPS for animated GIF encoding.
It might be the solution but I can't find any example of it
How Can I make this? anyone?
UPDATE: Use video_trimmer https://pub.dev/packages/video_trimmer instead
// Example of defining a custom command
// This is already used for creating GIF by
// default, so you do not need to use this.
await _trimmer
.saveTrimmedVideo(
startValue: _startValue,
endValue: _endValue,
ffmpegCommand:
'-vf "fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0',
customVideoFormat: '.gif')
.then((value) {
setState(() {
_value = value;
});
});
OUTDATED:
flutter_video_compress is an older package, but should work for most situations. Sometimes the file path can be an issue depending on which file picker you choose for videoFile.path
Convert video to a gif
final file = await _flutterVideoCompress.convertVideoToGif(
videoFile.path,
startTime: 0, // default(0)
duration: 2, // default(-1)
// endTime: -1 // default(-1)
);
debugPrint(file.path);
Can be found here: