Turning a short clip into a GIF sounds trivial until you try it and get a grainy, washed-out mess. That’s not your fault — GIF only allows 256 colors per frame, and a naive conversion picks a bad palette. The fix is to let FFmpeg study the clip first and build the best palette for it. The online GIF makers that do this for you also want your video uploaded and often slap on a watermark.
FFmpeg in WSL makes clean GIFs locally, for free, with full control over size and frame rate. Nothing gets uploaded.
No WSL yet? See the WSL install guide.
Install FFmpeg
sudo apt update && sudo apt install -y ffmpeg
Confirm:
ffmpeg -version
The quick (lower quality) way
A one-liner works, but expect a generic palette and a chunky file:
ffmpeg -i input.mp4 -vf "fps=12,scale=480:-1" output.gif
fps=12drops the frame rate to keep the size down.scale=480:-1sets width to 480px and height automatically.
This is fine for a rough GIF. For anything you’ll actually share, use the palette method.
The right way: build a palette first
This is a two-step process that gives GIFs their clean colors. First, generate a palette tailored to the clip:
ffmpeg -i input.mp4 -vf "fps=12,scale=480:-1,palettegen" palette.png
Then apply that palette while creating the GIF:
ffmpeg -i input.mp4 -i palette.png -lavfi "fps=12,scale=480:-1,paletteuse" output.gif
The difference is obvious — smoother gradients, accurate colors, far less banding. The two fps and scale values must match between the steps.
Make a GIF from just part of the video
Most GIFs are a few seconds. Use -ss (start time) and -t (duration) to grab a segment. Generate the palette and the GIF from the same window:
ffmpeg -ss 5 -t 3 -i input.mp4 -vf "fps=12,scale=480:-1,palettegen" palette.png
ffmpeg -ss 5 -t 3 -i input.mp4 -i palette.png -lavfi "fps=12,scale=480:-1,paletteuse" output.gif
This takes a 3-second clip starting at the 5-second mark.
Control the file size
GIF gets big fast. The three levers:
Keeping GIFs small
| fps=10-15 | Lower frame rate — biggest, easiest saving |
|---|---|
| scale=480:-1 | Smaller width — 320-480px is plenty |
| -t 2-4 | Keep it short |
| palettegen + paletteuse | Better quality at the same size |
A 480px-wide, 12 fps, 3-second GIF with a palette usually looks great and stays a reasonable size. Push resolution or length up and the file balloons.
If you want even higher quality: gifski
gifski is built specifically for high-quality GIFs. It works from frames or video and can look superb, though files tend to be larger:
sudo apt install -y gifski
FFmpeg’s palette method handles most needs and is built in, so try it first. Reach for gifski when visual quality matters more than file size.
Wrapping up
Making a clean GIF on Windows is the two-pass palette method: palettegen to build a palette for the clip, then paletteuse to apply it, with matching fps and scale filters. Use -ss and -t to grab just the segment you want, and keep the resolution, frame rate, and length down to control size.
It’s free, runs in WSL, and never uploads your clip. The same FFmpeg install also trims video without re-encoding and compresses video.