My Chirstmas gift to you

I think there’s something awesome about an image that can be animated. It’s different than a video clip because of the quick, loopy, and automatic nature of the format. GIFs have are a bit long in the tooth these days, and are not quite as optimized as should be for the modern web. The good news is, AVIF has an animation mode and it’s a much better solution than GIF.

To make an animated avif file, it seems be doable in FFMPEG!

sudo apt install ffmpeg

Now that we have a needed applications we can build the clip. You can always clip out a peice of video with Kdenlive or FFMPEG, I simply grabbed an animated GIF that I had on my machine, but the process is mostly the same.

ffmpeg -i INPUT_VIDEO.webm -pix_fmt yuv420p -an -y output.y4m

You might want to limit the size and framerate

ffmpeg -i INPUT_VIDEO.webm -vf "fps=15,scale=720:-1" -pix_fmt yuv420p -an -y output.y4m

Now we need to encode the video into an avif

ffmpeg -y -i output.y4m -c:v libsvtav1 -crf 30 -b:v 0 -an -y output.avif

Note

You might be able to get away running the command once, but for whatever reason in December of 2025, on Debian 13, it seems to have issues, unless you stage it to a y4m first.

ffmpeg -i INPUT_VIDEO.webm -vf "fps=15,scale=720:-1" -pix_fmt yuv420p -c:v libsvtav1 -crf 30 -b:v 0 -an -y output.avif

Let’s hope that works in the future.