How It Works
This page digs into how gif2avif works by showing you how to generate AVIFS files on your own computer.
If your GIFs are large or long, which this site doesn't support yet, the following method will let you make AVIFS files yourself. Or, if you have a large number of GIFs that you want to convert to AVIFS, using the technique below along with a little scripting will be faster and easier than using this site to generate AVIFS files one at a time.
Learn how to generate AVIFS files on your computer
It can be tricky to find an easy way to convert a GIF to an AVIFS file, also known as an animated AVIF or AVIF sequence.
The FFmpeg docs for librav1e are intimidating, for example, calling for users to build FFmpeg from source with
If you're familiar with the command line, or terminal, it is possible to generate an AVIFS file using a pretty simple two-step process.
First, you'll need to install
ffmpeg (availble in any Linux distro or via Homebrew on macOS) and
rav1e (from GitHub).
After extracting the
rav1e binary, you'll need to run a command with two parts: converting the GIF to a video, then converting that video to AVIFS.
In the following command, you'll need to make some replacements.
path_to_your.gifwith the GIF file you want to convert
./rav1ewith the path to the rav1e
path_to_your.avifswith the filename of your new AVIFS file.
ffmpeg -y -i path_to_your.gif -vsync 0 -pix_fmt yuv420p -f yuv4mpegpipe - | ./rav1e - -o - > path_to_your.avifs
That's it! You're set up to generate AVIFS files from GIFs on your own computer.
If you're still here, you must be looking to learn more.
So, why the two steps?
The main reason is that
rav1e isn't designed to encode any video format.
rav1e requires input video to be in
.y4m format, also known as YUV4MPEG2, which is uncompressed.
The first step in the process outlined above is to use
ffmpeg to convert a GIF to a Y4M.
The second step takes that Y4M file and encodes it into AV1 via
rav1e, outputting an AVIFS file.
While the above example uses
rav1e because it's easy to download and start using, there are a number of other AV1 encoders worth mentioning:
- dav1d, by the team behind VLC player is "the fastest AV1 decoder on all platforms :)"
- AOM, by the Alliance for Open Media (and also standing for that) can be built using Emscripen, allowing it to compile to WebAssembly to be used in web browsers
- SVT-AV1, a work-in-progress, research-focused AV1 encoder/decoder "targeting performance levels applicable to both VOD and Live encoding / transcoding video applications"