Home → The Classics → Farai's Codelab
Stop Using GIFs. Use Videos and Other Image Formats Instead
Published:
GIFs (pronounced yiffs1) are an integral part of the world wide web. Whether they’re used express emotions or to illustrate a concept, these short looping images (well videos) are there to do it. As great as they are they have problems, biggest of which are their filesizes. Thankfully, there are alternatives you can use instead that are far better.
In this post, I’ll describe the alternatives, how they perform (in my very limited use case) and how to use them.
The Alternatives
You can replace GIFs with either a video or another animated image.
For animated images, you have WebP and sequenced AVIF. For videos, you can encode them with H.264/AVC, H.265/HEVC, VP9 or AV1. Each of these have differing levels of support across browsers as shown by this table (using data from Can I Use).
Format | Internet Explorer 11 | Legacy Edge | Firefox | Safari/WebKit | Chrome/Chromium |
---|---|---|---|---|---|
WebP Image | No | No | Yes | iOS 14+/Safari 14 on Big Sur | Yes |
Sequenced AVIF Image | No | No | 89+ | No | 85+ |
H.264/AVC Video in MP4 | Yes | Yes | Yes | Yes | Yes |
H.265/AVC Video in MP4 | w/ Hardware Support | w/ Hardware Support | No | Yes | No |
VP9 in WebM | w/ Installed Codecs | w/ Installed Codecs | Yes | No | Yes |
AV1 in WebM | No | No | Yes | No | Yes |
Difference Between Media Codecs and Containers
A codec is how video and audio streams are encoded and decoded. Examples include the H.264 and AV1 for video, AAC and Opus for audio.
A container is a file format which holds multiple video and audio streams along with data like subtitles, menus and metadata. Examples include MP4, WebM, MP3 (which is a codec on its own as well) and AVI.
How They Perform (In My Very Limited Example)
For my example, I’ll use clip from the video game Yakuza 0 of deuteragonist Goro Majima who unfolds his arms to the side exclaiming “holy shit”, all while the camera is zooming in on him.
Don’t care how the creator of GIF pronounces it [VIDEO 03:13]—I’m correct. ↩︎