Pre-requisite
- install ffmpeg in Ubuntu
and
check version using
this will output like below
How to use
- Create a palette image from the video
This will generate a image file near to video file.
- Now use this image while generating gif
here are what these options meanings are; you can either remove or change the value of options
-y
=> overwrite output file without asking-ss
=> skip first 5 seconds-t
=> duration for 40 seconds-i
=> input ( write twice ; one for video and one for image palette )-r
=> set frame rate
- another way using
-filter_complex
option ( which is little bit tricky)
here in scale
option; we can change it to 1280 if require large gif
Bonus Tip
you can generate gif without image palette generation suing below command ( change the option as per your need)