MPEG to GIF Converter

Use FFmpeg to extract frames from any MPEG file and produce a palette-optimized animated GIF.

Choose a Conversion Method

The two-pass palette method produces the best quality. The quick single-pass is faster but colors may look banded.

1

Install FFmpeg

  • Windows: Download from ffmpeg.org/download.html, extract, add bin/ to PATH.
  • macOS: brew install ffmpeg
  • Linux: sudo apt install ffmpeg
2

Generate the palette

This first pass analyzes the video and creates an optimized 256-color palette file.

Pass 1 — build palette
ffmpeg -i input.mpeg -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png
3

Produce the GIF using the palette

The second pass dithers the video frames against the palette you just built.

Pass 2 — render GIF
ffmpeg -i input.mpeg -i palette.png -vf "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
4

Check the output

Open output.gif in a browser tab or image viewer. You can delete palette.png when done.

Tip — Convert Only Part of the File

Add -ss (start) and -t (duration) before -i to limit the segment:

ffmpeg -ss 00:00:05 -t 6 -i input.mpeg -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png

Use the same -ss and -t values in Pass 2 as well.

Estimated GIF File Sizes

Sizes are approximate for a 5-second clip from typical MPEG footage. Actual size varies with motion complexity and color range.

Width 10 fps 15 fps 24 fps
320 px ~1–2 MB ~2–3 MB ~3–5 MB
480 px ~2–4 MB ~4–7 MB ~7–12 MB
640 px ~4–7 MB ~7–14 MB ~14–25 MB
1280 px ~15–30 MB ~30–55 MB ~55–100 MB

For web sharing, keep GIFs under 5 MB. Consider hosting as a muted autoplay MP4 for anything larger — same visual result, 10–20x smaller file.

FFmpeg Command Builder

Adjust the options below to generate a ready-to-run FFmpeg command for your MPEG-to-GIF conversion.

Pass 1 — palette
Pass 2 — GIF
Copied!

Summary

Use FFmpeg to extract frames from any MPEG file and produce a palette-optimized animated GIF.

How it works

  1. Install FFmpeg on your system (Windows, macOS, or Linux).
  2. Choose the time range and frame rate — lower fps and shorter clips produce smaller GIFs.
  3. Generate a color palette from the source video for sharper, more accurate colors.
  4. Run the two-pass FFmpeg command to produce the final animated GIF.
  5. Check file size — typical 5-second GIFs at 15 fps range from 1–10 MB.

Use cases

  • Turn a short MPEG clip into a looping GIF for a README or documentation.
  • Create an animated preview of a video tutorial or screen recording.
  • Convert old MPEG home video moments into shareable GIF reactions.
  • Generate thumbnail animations for video product pages.
  • Extract a highlight clip from a recorded MPEG broadcast as a GIF.
  • Produce low-frame-rate GIFs for slow-connection environments.

Frequently Asked Questions

Last updated: 2026-06-11 · Reviewed by Nham Vu