How to Convert GIF to AV1/AVIF Video — Smaller Files, Better Quality
AV1 is the codec that makes GIF obsolete. A 10 MB animated GIF becomes a 300 KB AV1 video with better color depth, no dithering artifacts, and smooth playback. The catch: AV1 encoding is slow. Really slow. But the output is worth it.
This guide covers both conversions: GIF to AV1 video (MP4/WebM container) for replacing animated GIFs on the web, and GIF to AVIF for animated images that work like GIFs but at a fraction of the file size.
Key Takeaways
- AV1 video files are typically 90-95% smaller than equivalent GIFs
- FFmpeg's
libaom-av1orlibsvtav1encoders handle the conversion- AVIF (the image format based on AV1) supports animation — a direct GIF replacement
- Browser support for AV1 video: Chrome, Firefox, Edge, Safari 17+ (all major browsers)
- Encoding is 5-20x slower than H.264, but you encode once and serve forever
GIF vs AV1: Why Bother Converting?
| Metric | Animated GIF | AV1 Video | AVIF Animation |
|---|---|---|---|
| File size (10s clip) | 8-15 MB | 200-500 KB | 300-800 KB |
| Colors | 256 per frame | 10-bit HDR capable | 10-bit HDR capable |
| Transparency | Binary (on/off) | Alpha channel | Alpha channel |
| Compression | LZW (1987) | AOM (2018) | AOM (2018) |
| Browser support | Universal | Chrome, Firefox, Edge, Safari 17+ | Chrome 85+, Firefox 93+, Safari 16+ |
The numbers are dramatic. A GIF with 256 colors and LZW compression from 1987 cannot compete with a modern video codec designed by the Alliance for Open Media.
How to Convert GIF to AV1 Video (FFmpeg)
Method 1: SVT-AV1 (Faster Encoding)
SVT-AV1 (Scalable Video Technology for AV1) is the fastest AV1 encoder. Use this for batch conversions or when encoding time matters.
ffmpeg -i animation.gif -c:v libsvtav1 -crf 30 -preset 6 -pix_fmt yuv420p \
-movflags +faststart output.mp4Parameters explained:
-c:v libsvtav1— SVT-AV1 encoder (fast)-crf 30— Quality level (lower = better quality, bigger file. 25-35 is the sweet spot)-preset 6— Speed preset (0=slowest/best, 13=fastest. 6 is a good balance)-pix_fmt yuv420p— Pixel format for maximum compatibility-movflags +faststart— Moves metadata to the front for faster web streaming
Method 2: libaom-av1 (Better Quality, Slower)
The reference AV1 encoder from the Alliance for Open Media. Better compression than SVT-AV1 at the cost of encoding speed.
ffmpeg -i animation.gif -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 4 \
-pix_fmt yuv420p -movflags +faststart output.mp4Parameters explained:
-c:v libaom-av1— Reference AV1 encoder-crf 30 -b:v 0— Constant quality mode (must set-b:v 0for CRF to work)-cpu-used 4— Speed setting (0-8, higher = faster but lower quality)
Method 3: AV1 in WebM Container
If you prefer WebM over MP4:
ffmpeg -i animation.gif -c:v libsvtav1 -crf 28 -preset 6 -pix_fmt yuv420p output.webmWebM with AV1 has slightly narrower support than MP4 with AV1, but both work in all modern browsers.
With Resizing and Frame Rate Control
ffmpeg -i large_animation.gif -c:v libsvtav1 -crf 28 -preset 6 \
-vf "scale=640:-2,fps=24" -pix_fmt yuv420p -movflags +faststart output.mp4The -vf "scale=640:-2,fps=24" filter resizes to 640px wide (maintaining aspect ratio with even height) and sets 24fps.
How to Convert GIF to AVIF (Animated Image)
AVIF is the image format based on AV1. It supports animation, making it a true drop-in GIF replacement — you can use it in <img> tags, no <video> element needed.
Using FFmpeg
ffmpeg -i animation.gif -c:v libaom-av1 -crf 28 -b:v 0 -cpu-used 4 \
-pix_fmt yuv420p -loop 0 output.avifThe -loop 0 flag makes the animation loop infinitely, just like a GIF.
Using libavif (avifenc)
For higher quality animated AVIF output:
# First extract frames from GIF
ffmpeg -i animation.gif -vsync vfr frame_%04d.png
# Encode to animated AVIF
avifenc --min 20 --max 30 --speed 6 --fps 15 \
frame_0001.png frame_0002.png ... output.avifUsing ImageMagick 7
magick animation.gif -quality 60 output.avifSimple but with less control over encoding parameters than FFmpeg or avifenc.
Browser-Based Conversion (No Installation)
Don't want to install FFmpeg? Convert GIF to MP4 instantly in your browser:
- Go to GifToVideo.net
- Drop your GIF file
- Download the MP4 (H.264)
The browser converter currently outputs H.264 MP4, which is 85-90% smaller than GIF. For AV1 specifically, FFmpeg on the command line is your best option — browser-based AV1 encoding is too slow to be practical in 2026.
Using AV1 Video as GIF Replacement on the Web
Replace <img src="animation.gif"> with a muted, auto-playing video:
<video autoplay loop muted playsinline>
<source src="animation.av1.mp4" type="video/mp4; codecs=av01.0.05M.08">
<source src="animation.h264.mp4" type="video/mp4">
<img src="animation.gif" alt="Fallback for old browsers">
</video>This serves AV1 to browsers that support it, falls back to H.264, and uses the original GIF as a last resort.
Using AVIF in HTML
<picture>
<source srcset="animation.avif" type="image/avif">
<source srcset="animation.webp" type="image/webp">
<img src="animation.gif" alt="Animated content" loading="lazy">
</picture>AVIF in a <picture> element works exactly like any other image format. No JavaScript, no video element.
AV1 Encoding Speed: What to Expect
AV1 encoding is computationally expensive. Here's what a 5-second, 480p GIF conversion looks like:
| Encoder | Preset | Encoding Time | File Size | Quality |
|---|---|---|---|---|
| libsvtav1 | preset 8 (fast) | ~3 seconds | 180 KB | Good |
| libsvtav1 | preset 4 (balanced) | ~15 seconds | 150 KB | Better |
| libaom-av1 | cpu-used 6 | ~20 seconds | 145 KB | Better |
| libaom-av1 | cpu-used 2 | ~90 seconds | 130 KB | Best |
| libx264 (H.264) | ultrafast | Under 1 second | 250 KB | Good |
For animated GIF replacement, SVT-AV1 at preset 6-8 offers the best speed-to-quality ratio. You don't need reference-encoder quality for a looping meme.
Batch Conversion Script
Convert all GIFs in a folder to AV1 MP4:
#!/bin/bash
for gif in *.gif; do
name="${gif%.gif}"
ffmpeg -i "$gif" -c:v libsvtav1 -crf 30 -preset 6 \
-pix_fmt yuv420p -movflags +faststart "${name}.mp4"
echo "Converted: $gif → ${name}.mp4"
doneAV1 Hardware Decoding Support
Even though AV1 encoding is slow in software, hardware decoding is widely supported:
- Desktop GPUs: NVIDIA RTX 30/40/50 series, AMD RX 6000/7000/9000 series, Intel Arc
- Mobile SoCs: MediaTek Dimensity 1000+, Qualcomm Snapdragon 888+, Samsung Exynos 2100+, Apple A17 Pro+
- Browsers: All major browsers use hardware decoding when available
Hardware decoding means smooth, power-efficient playback. Encoding is the hard part — playback is free.
Troubleshooting
"Unknown encoder libsvtav1"
Your FFmpeg build doesn't include SVT-AV1. Options:
- Install from a package manager:
brew install ffmpeg(macOS) orsudo apt install ffmpeg(Ubuntu 22.04+) - Download a static build from FFmpeg.org
- Use
libaom-av1instead (included in more FFmpeg builds)
"Encoding is too slow"
Switch to SVT-AV1 with a higher preset number:
ffmpeg -i input.gif -c:v libsvtav1 -crf 32 -preset 10 -pix_fmt yuv420p output.mp4Preset 10-12 is fast but still produces smaller files than H.264.
"Output video doesn't loop"
MP4 and WebM videos don't have a built-in loop flag. Add loop attribute in HTML:
<video autoplay loop muted playsinline src="output.mp4"></video>For AVIF, use -loop 0 during encoding.
"Colors look washed out"
GIFs use sRGB with 256 colors. AV1 uses YUV color space by default. Add color space metadata:
ffmpeg -i input.gif -c:v libsvtav1 -crf 28 -preset 6 \
-pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 \
-colorspace bt709 output.mp4FAQ
Is AV1 better than H.264 for replacing GIFs?
Yes. AV1 produces 30-50% smaller files than H.264 at the same visual quality. The tradeoff is encoding speed — AV1 is 5-20x slower to encode. For web content that gets encoded once and served millions of times, AV1 is the better choice.
Can I use AVIF instead of GIF everywhere?
Almost. AVIF animation is supported in Chrome 85+, Firefox 93+, Edge 85+, and Safari 16+. That covers approximately 95% of global browser usage as of 2026. Use a <picture> element with GIF fallback for the remaining 5%.
Does AV1 support transparency like GIF?
Yes, and better. GIF only supports binary transparency (each pixel is fully transparent or fully opaque). AV1 supports a full alpha channel with 256 levels of transparency. Encode with: ffmpeg -i input.gif -c:v libaom-av1 -crf 28 -b:v 0 -pix_fmt yuva420p output.webm
What's the difference between AV1 and AVIF?
AV1 is a video codec. AVIF is an image format that uses AV1 compression for individual frames or frame sequences. An animated AVIF is essentially an AV1 video in an HEIF container. Use AV1 video (MP4/WebM) for <video> elements; use AVIF for <img> elements.
How much bandwidth does GIF-to-AV1 conversion save?
A typical animated GIF is 5-15 MB. The same content as AV1 video is 200-500 KB — a 90-95% reduction. For a website serving 100,000 GIF views per day at 10 MB each, switching to AV1 saves approximately 950 GB of bandwidth per day.
Conclusion
GIF to AV1 conversion is the single biggest performance win for websites that use animated content. A 10 MB GIF becomes a 300 KB AV1 video — same visual quality, 97% less bandwidth.
Use SVT-AV1 with FFmpeg for the best speed-to-quality ratio. Use AVIF if you need an <img>-compatible format. Either way, your animated content gets smaller, loads faster, and looks better.
For quick GIF-to-video conversion without command-line tools, try GifToVideo.net — free, browser-based, no upload required.
Sources
- Alliance for Open Media, "AV1 Codec," retrieved 2026-05-18, https://aomedia.org/av1/
- FFmpeg Documentation, "libsvtav1 encoder," retrieved 2026-05-18, https://ffmpeg.org/ffmpeg-codecs.html#libsvtav1
- Can I Use, "AV1 video format," retrieved 2026-05-18, https://caniuse.com/av1
- Can I Use, "AVIF image format," retrieved 2026-05-18, https://caniuse.com/avif
- Google Web Developers, "Serve images in modern formats," retrieved 2026-05-18, https://developer.chrome.com/docs/lighthouse/performance/uses-webp-images
