Convert WebP to GIF with ffmpeg command?

Use ffmpeg to read the input WebP (animated or single frame) and write GIF. Basic commands:

  • For animated WebP -> animated GIF (preserve animation): ffmpeg -i input.webp -vf "fps=15,scale=trunc(iw/2)*2:trunc(ih/2)*2" -loop 0 output.gif

  • Better color quality (dither + palette) for animated conversions: ffmpeg -i input.webp -vf "fps=15,scale=trunc(iw/2)*2:trunc(ih/2)*2,palettegen=stats_mode=diff" -y palette.png ffmpeg -i input.webp -i palette.png -lavfi "fps=15,scale=trunc(iw/2)*2:trunc(ih/2)*2 [x]; [x][1:v] paletteuse=dither=bayer:bayer_scale=5" -loop 0 output.gif

    Or the two-step in a single pipeline: ffmpeg -i input.webp -filter_complex "fps=15,scale=trunc(iw/2)*2:trunc(ih/2)*2,palettegen=stats_mode=diff[p];[0:v]fps=15,scale=trunc(iw/2)*2:trunc(ih/2)*2[x];[x][p]paletteuse=dither=bayer:bayer_scale=5" -loop 0 output.gif

  • If input is a single-frame WebP (convert to static GIF): ffmpeg -i input.webp -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -frames:v 1 output.gif

Notes and options:

  • Adjust fps=15 to control speed/smoothness (use the original frame rate if known).
  • GIF dimensions must be even for some ffmpeg builds; scale with trunc(...)*2 enforces that.
  • Using palettegen + paletteuse gives much better colors and smaller size than direct conversion.
  • Replace dither and palette options (e.g., floyd_steinberg, sierra2) to change visual quality/size.
  • -loop 0 makes the GIF loop indefinitely; omit or set -loop 1 for a single play.

If you want, tell me whether your WebP is animated or single-frame and your desired fps/quality and I’ll give a tuned command.

Have your own question?

Ask the AI now

Free · no account needed · answer in seconds