Safari already supports playing MP4 in <img> tags [1]. I think that's how "animated GIF" type of animations should be handled in the Web.
It's silly that there are video formats with excellent compression but image formats want to reinvent it (such as animated PNG, animated WebP, animated AVIF...). It just adds extra complexity to image formats.
Ah, that seems exactly like I was asking for, unfortunately in the 3 years since Safari added it, I can't find much pick up on it. I found this on Chromium but with not much progress. It seems their code path doesn't quite let img decode a video, I assumed it would be as easy as creating a fake <video muted loop autoplay> but it's probably much more messy.
It's silly that there are video formats with excellent compression but image formats want to reinvent it (such as animated PNG, animated WebP, animated AVIF...). It just adds extra complexity to image formats.
[1] https://developer.apple.com/documentation/webkit/delivering_...