Convert GIF to AV1/AVIF — Smaller Files, Better Quality

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-av1 or libsvtav1 encoders 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?

MetricAnimated GIFAV1 VideoAVIF Animation
File size (10s clip)8-15 MB200-500 KB300-800 KB
Colors256 per frame10-bit HDR capable10-bit HDR capable
TransparencyBinary (on/off)Alpha channelAlpha channel
CompressionLZW (1987)AOM (2018)AOM (2018)
Browser supportUniversalChrome, 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.mp4

Parameters 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.mp4

Parameters explained:

  • -c:v libaom-av1 — Reference AV1 encoder
  • -crf 30 -b:v 0 — Constant quality mode (must set -b:v 0 for 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.webm

WebM 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.mp4

The -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.avif

The -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.avif

Using ImageMagick 7

magick animation.gif -quality 60 output.avif

Simple 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:

  1. Go to GifToVideo.net
  2. Drop your GIF file
  3. 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:

EncoderPresetEncoding TimeFile SizeQuality
libsvtav1preset 8 (fast)~3 seconds180 KBGood
libsvtav1preset 4 (balanced)~15 seconds150 KBBetter
libaom-av1cpu-used 6~20 seconds145 KBBetter
libaom-av1cpu-used 2~90 seconds130 KBBest
libx264 (H.264)ultrafastUnder 1 second250 KBGood

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"
done

AV1 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) or sudo apt install ffmpeg (Ubuntu 22.04+)
  • Download a static build from FFmpeg.org
  • Use libaom-av1 instead (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.mp4

Preset 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.mp4

FAQ

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