>FFmpegLab Start free
FFmpeg Guide

How to convert video to GIF with FFmpeg

Start with a quick one-liner, then use the palettegen / paletteuse two-step for crisp, banding-free GIFs — with control over frame rate, width, and file size.

Turn clips into clean GIFs — in your browser.

Free in your browser — nothing to install, nothing uploaded.

GIF only supports 256 colors per frame, so the quality of the conversion comes down to which 256 colors get picked. The naive one-liner lets FFmpeg guess and you get banding. The high-quality approach generates a custom palette from your clip first, then maps the video onto it — the single biggest quality win available.

Key takeaways

Quick one-liner

Good enough for a rough preview — scale down and cap the frame rate so it isn't enormous:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i in.mp4 -vf "fps=12,scale=480:-1:flags=lanczos" out.gif

High-quality GIF (palettegen + paletteuse)

Generate a palette tuned to your clip, then reuse it. This removes most banding and keeps colors true:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# step 1: build a palette from the clip
ffmpeg -i in.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png

# step 2: render the GIF using that palette
ffmpeg -i in.mp4 -i palette.png -filter_complex \
  "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" out.gif

Shrink the GIF

If the file is still too big, pull the three levers: shorter clip, lower fps, smaller width. A single-palette pass with light dithering also helps:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# 3-second clip, 10 fps, 360px wide, lighter dithering
ffmpeg -ss 0 -t 3 -i in.mp4 -i palette.png -filter_complex \
  "fps=10,scale=360:-1[x];[x][1:v]paletteuse=dither=bayer:bayer_scale=3" small.gif

Export GIFs visually instead

FFmpegLab exports a GIF straight from the timeline with the palette step handled for you, so you get clean colors without running two passes — all offline. Trim to the exact moment first, or crop to frame it before exporting.

✦  Fresh from the render queue

Better FFmpeg workflows, delivered.

Get practical commands, new templates, and deep-dive guides for the edits that are usually hardest to get right.

✓  Copy-pasteable commands    ✓  Editor templates    ✓  No noise
One useful email at a time.

Turn clips into clean GIFs — in your browser.

Free in your browser — nothing to install, nothing uploaded.