How to Convert Any Video to GIF (MP4, MOV, AVI) — Free Guide 2026
Seven billion GIFs are sent daily across messaging platforms (Giflytics, 2024), and 69% of Americans say GIFs communicate emotions more effectively than words alone. You've got a video clip and you need a GIF. Maybe it's an MP4 screen recording, an iPhone MOV file, an old AVI clip, or a WebM download. The good news: the conversion process is nearly identical regardless of the source format. FFmpeg doesn't care what container your video uses — it reads them all.
The bad news: each format has quirks that can trip you up. MOV files from iPhones use HEVC (H.265) which some tools can't decode. AVI files might contain ancient codecs. WebM files with alpha channels need special handling. This guide covers every format with the exact commands and gotchas for each.
Key Takeaways
- FFmpeg converts any video format (MP4, MOV, AVI, WebM, MKV, FLV) to GIF using the same palette method
- iPhone MOV files use HEVC — make sure your FFmpeg build includes
libx265support- Browser-based conversion accepts all common formats and handles codec detection automatically
- The palette method works identically across formats: generate palette → apply palette → done
- Optimize output with 10-12fps, 480px width, and 3-5 second duration for best results
Video Formats Explained (For GIF Conversion)
Before converting, it helps to understand what you're working with. Video formats are really two things: a container (the file extension) and a codec (the compression algorithm inside).
| Format | Container | Common Codecs | Where You Get It |
|---|---|---|---|
| MP4 | MPEG-4 Part 14 | H.264, H.265/HEVC | Everywhere — most universal |
| MOV | QuickTime | H.264, HEVC, ProRes | iPhone recordings, Mac apps |
| AVI | Audio Video Interleave | MPEG-4, DivX, Xvid, MJPEG | Legacy cameras, old downloads |
| WebM | Matroska-based | VP8, VP9, AV1 | Web downloads, Discord, YouTube |
| MKV | Matroska | Nearly anything | Rips, screen recorders |
| FLV | Flash Video | H.264, VP6 | Old web videos |
Why this matters for GIF conversion: The container format is mostly irrelevant — FFmpeg reads all of them. What matters is the codec inside. HEVC (common in iPhone MOV files) requires specific FFmpeg libraries. ProRes (from Final Cut Pro) produces huge files. Ancient AVI codecs might need legacy codec packs. The conversion commands are identical; the setup differs.
The Universal GIF Conversion Command
This two-step palette method works for every video format FFmpeg supports:
Step 1: Generate palette
ffmpeg -i input.VIDEO -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.pngStep 2: Convert with palette
ffmpeg -i input.VIDEO -i palette.png -lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifReplace input.VIDEO with your actual file — clip.mp4, recording.mov, old_video.avi, download.webm. The commands are identical.
Single-command version (no intermediate file):
ffmpeg -i input.VIDEO -filter_complex "[0:v] fps=12,scale=480:-1:flags=lanczos,split [a][b];[a] palettegen [p];[b][p] paletteuse" output.gifFormat-Specific Commands and Gotchas
MP4 to GIF
MP4 is the most common source format. H.264-encoded MP4 files work with every FFmpeg build out of the box.
ffmpeg -i clip.mp4 -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i clip.mp4 -i palette.png -lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifGotcha: MP4 files with H.265/HEVC encoding (increasingly common from modern phones) require FFmpeg compiled with --enable-libx265. Check with ffmpeg -decoders | grep hevc.
Detailed MP4 to GIF guide with optimization tips
MOV to GIF (iPhone & Mac)
MOV files from iPhones typically use HEVC (H.265) at up to 4K resolution. Two things to watch for:
# Standard MOV to GIF
ffmpeg -i recording.mov -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i recording.mov -i palette.png -lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifGotcha 1: HEVC decoding. If you see Decoder hevc not found, your FFmpeg doesn't support H.265. On Mac, install with Homebrew: brew install ffmpeg (includes HEVC by default). On Linux: sudo apt install ffmpeg (most recent distros include it).
Gotcha 2: iPhone 4K resolution. iPhone records at 3840x2160. Scaling to 480px is a 8x reduction. Use scale=640:-1 if you need more detail, but expect larger files.
Gotcha 3: ProRes MOV. Final Cut Pro exports use Apple ProRes, which produces massive files (a 10-second clip can be 500 MB+). FFmpeg handles ProRes fine — the palette method automatically manages the color conversion.
AVI to GIF
AVI is a legacy format that can contain almost any codec. Most issues come from old, uncommon codecs.
ffmpeg -i old_clip.avi -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i old_clip.avi -i palette.png -lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifGotcha: Unknown codecs. If FFmpeg reports Unknown decoder, the AVI uses a proprietary codec (common with old security cameras and early 2000s video). Try converting the AVI to MP4 first:
ffmpeg -i old_clip.avi -c:v libx264 -preset fast temp.mp4
ffmpeg -i temp.mp4 -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i temp.mp4 -i palette.png -lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifGotcha: Variable frame rate. Some AVI files have inconsistent frame timing. Add -vsync vfr if you see frame duplication or stuttering in the output GIF.
WebM to GIF
WebM files are common from web downloads, Discord, and screen recorders. VP8 and VP9 work out of the box.
ffmpeg -i download.webm -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i download.webm -i palette.png -lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifGotcha: Alpha channel. Some WebM files have transparency (VP9 with alpha). GIF supports 1-bit transparency (pixel is either fully transparent or fully opaque). FFmpeg will convert the smooth alpha to binary — edges may look jagged. If the source has a transparent background, consider adding a solid color:
-vf "fps=12,scale=480:-1:flags=lanczos,format=rgba,colorize=color=white"Browser-Based Conversion (Any Format)
Don't want to install FFmpeg? Our browser-based converter handles all common formats automatically.
Steps:
- Go to GifToVideo.net/video-to-gif
- Drop your video file (MP4, MOV, AVI, WebM, MKV)
- Adjust frame rate, width, and trim points
- Click Convert — download your GIF
Format support note: The browser converter uses FFmpeg.wasm which supports all major codecs including H.264, HEVC, VP8, VP9, and most legacy AVI codecs. Your file never leaves your device — everything processes locally in your browser. The tradeoff: it's slower than native FFmpeg, especially for large files (over 50 MB).
Converting iPhone and Android Videos
iPhone (MOV/HEVC)
iPhones record in MOV with HEVC by default since iPhone 7. The files are typically 30fps at 1080p or 4K.
Quick method: Drop your .mov file on GifToVideo.net/video-to-gif — it handles HEVC automatically.
FFmpeg method with trimming:
# Trim to 3 seconds starting at 00:05, then convert to GIF
ffmpeg -ss 5 -t 3 -i IMG_1234.MOV \
-vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -ss 5 -t 3 -i IMG_1234.MOV -i palette.png \
-lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifAndroid (MP4/H.264)
Android phones record in MP4 with H.264 — the easiest format to work with. No special handling needed.
ffmpeg -i VID_20260518.mp4 -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i VID_20260518.mp4 -i palette.png \
-lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gifOptimization Tips for All Formats
Regardless of source format, the same optimization rules apply:
| Setting | Recommendation | Impact |
|---|---|---|
| Frame rate | 10-12 fps | 50-60% size reduction vs 30fps |
| Width | 480px | Good for Slack/Discord/email |
| Duration | 3-5 seconds | Every extra second adds ~20% |
| Colors | 256 (default) | Reduce to 128 for another 15-20% |
| Post-processing | gifsicle -O3 --lossy=80 | Additional 10-30% reduction |
Target sizes by platform:
- Slack: Under 5 MB (25 MB max)
- Discord: Under 5 MB (8 MB max for free)
- Email: Under 1 MB
- GitHub README: Under 3 MB
For detailed optimization techniques, see our MP4 to GIF guide.
Batch Conversion (All Formats at Once)
Convert a folder of mixed-format videos to GIF:
for f in *.mp4 *.mov *.avi *.webm; do
[ -f "$f" ] || continue
name="${f%.*}"
ffmpeg -i "$f" -vf "fps=12,scale=480:-1:flags=lanczos,palettegen" /tmp/palette.png
ffmpeg -i "$f" -i /tmp/palette.png \
-lavfi "fps=12,scale=480:-1:flags=lanczos [x]; [x][1:v] paletteuse" \
"${name}.gif"
echo "Converted: $f → ${name}.gif"
doneFrequently Asked Questions
Can I convert any video format to GIF?
Yes. FFmpeg supports virtually every video format: MP4, MOV, AVI, WebM, MKV, FLV, WMV, MPEG, 3GP, and many more. The conversion command is identical regardless of the source format — only the input filename changes. The occasional exception is a file using a proprietary or very old codec, in which case converting to MP4 first usually solves the problem.
Why does my iPhone MOV file fail to convert?
Most likely because your FFmpeg installation doesn't include HEVC (H.265) decoder support. iPhones record in HEVC by default since iPhone 7. On Mac, brew install ffmpeg includes HEVC. On Linux, install from your distribution's package manager or download a static build from ffmpeg.org that includes all codecs.
Which video format produces the best GIFs?
The source format doesn't meaningfully affect GIF quality — the palette generation step handles color reduction uniformly. What matters is the source video's resolution, frame rate, and content complexity. A 1080p MP4 and a 1080p MOV with the same content will produce identical GIFs.
How do I convert just a portion of a video to GIF?
Use FFmpeg's -ss (start time) and -t (duration) flags before the input:
ffmpeg -ss 00:01:30 -t 5 -i video.mp4 ...This starts at 1 minute 30 seconds and captures 5 seconds. Place -ss before -i for fast seeking.
Can the browser converter handle MOV files from iPhone?
Yes. The browser-based converter at GifToVideo.net uses FFmpeg.wasm, which includes HEVC decoding support. Drop your .mov file and it will process locally in your browser — no upload, no server processing, no privacy concerns.
Conclusion
Converting video to GIF is the same process regardless of format. The universal palette method — generate a palette, then apply it — works for MP4, MOV, AVI, WebM, and everything else FFmpeg reads. The only format-specific concern is making sure your tools support the codec inside the container (especially HEVC for iPhone videos).
For quick one-off conversions, use a browser-based converter. For power users and batch processing, FFmpeg with the palette method delivers the best quality. Either way, remember the optimization basics: 10-12fps, 480px wide, 3-5 seconds, and you'll have GIFs that work everywhere.
Ready to convert? Try our free Video to GIF converter — supports MP4, MOV, AVI, WebM, and more. No signup, no upload, instant results.
Sources
- W3Techs, "Usage statistics of GIF for websites," retrieved 2026-05-18, https://w3techs.com/technologies/details/im-gif
- FFmpeg Documentation, "Supported file formats and codecs," retrieved 2026-05-18, https://ffmpeg.org/general.html#Supported-File-Formats_002c-Codecs-or-Features
- Apple Developer, "HEVC Video with Alpha," retrieved 2026-05-18, https://developer.apple.com/videos/play/wwdc2019/506/
- FFmpeg Wiki, "How to use the palettegen and paletteuse filters," retrieved 2026-05-18, https://ffmpeg.org/ffmpeg-filters.html#palettegen
