mozilla / standards-positions

https://mozilla.github.io/standards-positions/
Mozilla Public License 2.0
650 stars 72 forks source link

Animated AVIF #627

Open baumanj opened 2 years ago

baumanj commented 2 years ago

Request for Mozilla Position on an Emerging Web Specification

Other information

AVIF has shipped in Firefox since version 93 was released on October 5, 2021. As a result of being based on ISOBMFF, HEIF and MIAF, AVIF has a very rich feature set, not all of which is currently implemented in Firefox. Animations and image sequences are one such feature which is not currently implemented. Whether it is worth implementing depends on several factors including the prevalence of animated AVIF on the web and alternatives for achieving the same effect. Animated AVIF are essentially AV1 videos embedded in an MP4 (ISOBMFF) container. The main difference is that AVIF can additionally contain one or more still images, grids or other features described by HEIF. Furthermore, when present, either the primary still image (identified by a pitm box) or the animation (identified by a moov box) can be the preferred presentation, according to the avif or avis major brand respectively. Consider an animation with a poster frame (avis) versus a still image with a burst of frames captured before and after (avif) akin to Apple's Live Photos feature.

For some time now, sites like Twitter have implemented what the UX describes as GIFs via MP4 video since they provide better compression and fidelity. Similarly, https://github.com/whatwg/html/issues/7141 is an open proposal to allow video formats to be the source of <img> elements and has already been implemented in Webkit. Both of these approaches allow for the same use case that an AVIF with major brand avis does. The question is whether these kinds of files are worth supporting in the context of the web given the alternatives and currently relatively low prevalence.

martinthomson commented 2 years ago

@baumanj, do you want to offer your opinion? Personally, the idea that <video> (or <img> with a video source) addresses the need is somewhat appealing. More image formats doesn't seem to do anyone any favours. What potential advantages would web users get by having animation support added to AVIF images?

baumanj commented 2 years ago

Personally, I don't see much benefit over the other approaches, but perhaps there are arguments that I haven't encountered. Hopefully this forum will provide the opportunity to have that discussion.

190n commented 2 years ago

If animated AVIF gains OS support, it could offer better UX for downloading animations than the options that use video files (just right-click/"Save Image" like you already can with animated GIFs). And it wouldn't rely on being able to mark a video as looped (consider a forum that lets users upload images and video, but doesn't give them direct control over the markup used to display those attachments—currently you could only upload a GIF or upload a video that wouldn't loop). Anyway, as long as Firefox sends Accept: image/avif while only supporting some AVIF files, it is harder for websites to deploy animated AVIF without causing compatibility issues like Kickstarter did.

baumanj commented 2 years ago

I think the best short term solution to the problem that occurred at Kickstarter would be to implement <picture> fallback for AVIF files with avis (rather than avif) major brand. That is, if the file expresses its primary purpose is to be viewed as an animation, Firefox would fall back to the next supported alternative. Or, perhaps it's worth reconsidering separate MIME types.

o-t-w commented 2 years ago

Using a video element is a bad solution, ideally you would support both animated AVIF and video src for the img element.

Animated AVIF has the benefit that you can use it as a background-image in CSS. It is going to be supported by all other browsers so would be a major compatibility issue.

The versatility of being able to use whatever video format you want for is a plus over being forced to only ever use animated AVIF or animated WebP. The img element opens up possibilities not possible with a video element like showing a still image for prefers-reduced-motion etc

o-t-w commented 3 weeks ago

Firefox supports animated AVIF already so can this issue be closed?