FFmpeg: How to Convert a Video to High-Quality GIF (Small File Size)

Updated

Learn how to convert a video into a crisp, high-quality GIF with a small file size

FFmpeg: How to Convert a Video to High-Quality GIF (Small File Size)

Before starting, make sure you have FFmpeg installed on your system and your video file ready in your project folder.

Open your terminal or command prompt and navigate to the folder containing your video. We will run a command that generates a custom color palette on the fly and applies it to your animation for the best visual quality.

ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,split[a][b];[a]palettegen[p];[b][p]paletteuse" -loop 0 output.gif

Be sure to replace input.mp4 with your source video filename and output.gif with your desired output filename.

Press Enter to start the conversion. This process may take a few seconds depending on the length and resolution of your source clip.

Once processing completes, open output.gif in your browser or image viewer to verify that the video plays smoothly and looks sharp.

If you need to reduce the file size even further, try lowering the frame rate from fps=15 to fps=10 or changing the width from 480 to a smaller value like 320.