by arghwhat · 3w ago · 0 comments
If you want to optimize the user-facing side, you might want to pick HEIC instead to optimize for commonly available HEVC/h.265 hardware encoding capabilities, or to be selective instead and pick AVIF when AV1 capabilities are present.
AVIF is notoriously CPU-intensive to compress without acceleration, but assuming you pay for storage and/or delivery, the results are impressive. JPEG-XL and HEIC also do very well. JPEG really shouldn't be used unless you're trying to target devices that can only read JPEG.
So don't do that, please.
For various reasons, AVIF and HEIF/HEIC support is generally bundled together in the same decoders. Both of CrabbyAVIF and libheif, for example, read both AVIF and HEIF/HEIC, so while HEIC might sometimes be supported without AVIF, it's harder to have support for AVIF with HEIF/HEIC.
Browsers are a bit weird, not sure why they haven't enabled support.
(It would be an entirely new thing for you to use hardware decoders for stills, so no reason to worry about it as something restrictive.)
Regarding HEIC, you know the browser acceptance for this, do you? https://caniuse.com/?search=heic
120 seconds is an arbitrary number to throw out there, AVIF compression time is purely dependent on how aggressive you want the file compressed. The ability to go completely nuts with computation is great for when you create the assets once for example.
Native browser support for HEIC is poor, yes. No idea why tbh, the underlying libraries generally support it. Heck, AVIF and HEIF/HEIC support is almost universally bundled together.
Take CrabbyAVIF and libheif: both provide both AVIF and HEIF/HEIC support. Android uses CrabbyAVIF as the platform AVIF/HEIF reader for reference, and considering that Google Photos natively supports HEIF/HEIC (even in browser). They're also using CrabbyAVIF in Chromium, but for some reason they disabled the HEIF/HEIC feature.
If you're making browser apps, you will ultimately care about storage and bandwidth, so AVIF or JPEG-XL are your main options. Outside browser apps you can pick entirely as you please, and if end-user encoder performance matters, HEIC ends up likely winning as hardware AV1 encoders are still less common.