Open zcorpan opened 2 years ago
cc @whatwg/media
As someone who works for CDN with animation conversion feature: animated WebP is bad. We would prefer not to use it.
The animated WebP format has been designed to be conceptually similar to GIF, and work for the same use-cases that GIF does, but this made it inherit GIF's weaknesses. Content that makes GIF sizes balloon typically also compresses poorly in WebP. Both are especially inefficient for short video clips with camera motion — a use-case handled better even by ancient codecs like MPEG-1. WebP often fails to meaningfully reduce GIF file sizes, and can even end up making files larger than GIF.
@eeeps on why GIF is still used:
https://twitter.com/etportis/status/1442838357432700932
Many, many contexts that aren't built to accept video files and loop/mute/autoplay them, without displaying controls. e.g.: most CMSes, messaging platforms, and the
<img>
tag.
https://twitter.com/etportis/status/1443218535774253060
One perf use case for GIF over
<video>
is (I think) speculative preloading. Last I checked (a while ago...) a tiny GIF could render/autoplay faster than a tiny<video>
.
From an end-user perspective: the human doesn't really know the difference between a gif and an mp4 except perhaps the length of play. They are all 'gifs' to most humans.
A few considerations that should be defined:
<img src=mp4>
such as length of play? (eg: only auto play and loop a video up to 60s because of memory and bandwidth considerations)Accept: video/*
header be a required as a signal from the UA? (will this require coordination with the IETF?)<video src=mp4
when requesting a resource that contains a file extension of a known video format? <img src=hls
?dimX
, dimY
, resX
, resY
EXIF attributes in an ISOBMFF for intrinsic size calculations?should the UA support streaming formats
gif's can technically be streamed, so I think video streams should be allowed as well.
what are the equivalent
dimX
,dimY
,resX
,resY
EXIF attributes
This would be hard to set, because I know it's possible with with at least VP8 to actually change the size of the video with each frame.
A concern I have about the current Chrome approach of allowing AV1 wrapped in AVIF in an img tag, but not AV1 wrapped in any other container, is the following:
What about Nokia's patent claims on HEIF? AV1 is designed to be royalty-free, but the HEIF container that AVIF uses may not actually be royalty-free — at least Nokia does not give a patent grant, except for non-commercial purposes. See also: https://news.ycombinator.com/item?id=19874121
If we could use AV1 in any video container (in particular, in a non-patent-encumbered one), and not be forced to wrap it specifically in AVIF (which is based on HEIF), I would consider that a lot safer regarding potential patent trolling when adoption becomes larger and Nokia smells money. It would make perfect sense for them to lay low now and wait for more adoption before they start demanding royalties. These patents will only expire around 2035-2036, so they could be a problem.
For accessibility purposes, there are probably scenarios where you'll have to offer a way to pause the video. Will <img>
tags now have a JS .pause()
method?
From WCAG 2.1, potential friction point if an image can't be paused: 2.2.2 Pause, Stop, Hide.
@Sheraff This problem already exists for GIF. The difference is not in user-visible behavior (which I agree should be improved!), but in allowing smaller file sizes.
@kornelski this solution is being debated as
media
attribute in video <source>
tags (which still exists in the picture <source>
tags), in which case we would be losing accessibility features
- but also as a crutch for the removal of the
media
attribute in video<source>
tags (which still exists in the picture<source>
tags), in which case we would be losing accessibility features
Why would <img>
being able to load the same video formats as <video>
be an argument to not have the media
attribute in video <source>
tags? I think it's clear that the video tag is still needed for actual video (with audio, typically not looping, with controls, etc), and picture/img will not make it redundant.
So I think all of the following would be good, and they are imo orthogonal issues:
<img>
being able to load the same video formats as <video>
.pause()
method to images (also for GIF/APNG/animated WebP), and possibly change UA behavior to allow pausing animated imagesmedia
attribute in video <source>
tags@jonsneyers the media
attribute has already been removed from video <source>
tags. So at this point, we have no clean way of doing responsive videos for above-the-fold content. If <picture>
starts to support video content, developers are going to flock to this solution for the use-case of responsive above-the-fold videos.
So in my opinion, this change should either land with accessibility in mind, or land at the same time as some changes to the <video>
tag that solve the responsive above-the-fold videos use-case.
This issue is not about the media
attribute on video
's source
element. Continue that discussion in https://github.com/whatwg/html/issues/6363 please.
@Sheraff can you file a new issue about the ability to pause animated images in img
?
Related to https://github.com/whatwg/html/issues/6363
Regardless of what changes are made or not made to
video
, the question of which formatsimg
should support remains. That's this issue.WebKit supports video formats in
img
, while Gecko and Chromium do not.In https://bugs.chromium.org/p/chromium/issues/detail?id=791658 it was requested that Chromium support MP4/h.264 in
img
. The issue was closed asWontFix
:For the last point,
video
today doesn't have the same capabilities asimg
(e.g.srcset
,media
).For AVIF, I asked on Twitter if there are reasons why it would still make sense to support other video formats assuming
img
can load AVIF: https://twitter.com/zcorpan/status/1428459457407864836@jonsneyers
@kornelski
@jernoble
@zcorpan replied
@othermaciej replied