Use this guide to generate a good-looking GIF from a video clip by creating a palette first and then rendering the final GIF.
Install FFmpeg (if not already installed):
sudo apt-get install ffmpegbrew install ffmpegGenerate palette for better GIF quality
First create a palette:
ffmpeg -ss 00:00:10 -t 3 -i input.mp4 -vf "fps=12,scale=640:-1:flags=lanczos,palettegen" palette.png
-ss-tfps=12scale=640:-1Create GIF with the palette
Then render the GIF:
ffmpeg -ss 00:00:10 -t 3 -i input.mp4 -i palette.png -lavfi "fps=12,scale=640:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
Replace time values and file names as needed.
Tip: Higher FPS and resolution improve quality but increase file size significantly.