4 ms·
> as there will be large areas of single colours and few changes between frames which GIF is good at Pretty sure that's how modern video codecs work too. A lot
by technobabbler 5y ago
> as there will be large areas of single colours and few changes between frames which GIF is good at
Pretty sure that's how modern video codecs work too. A lot of movies have regions that don't change much between frames (e.g. backgrounds, or some dude's face staring at the camera all dramatically).
What GIF gets you is a lossless video, which is overkill for most applications. Video codecs can achieve a similar perceptual quality at a tiny fraction of the size, which is why services like gyfcat and imgur will often auto-convert gifs to videos for browsers that support it.
Take this 2MB GIF (https://blackmagic.so/assets/sidebar/most-engaging-hours.gif https://blackmagic.so/assets/sidebar/most-engaging-hours.gif) and put it through an online converter: https://ezgif.com/gif-to-mp4/ezgif-7-68b177ec1944.gif https://ezgif.com/gif-to-mp4/ezgif-7-68b177ec1944.gif
WebP: 1.64 MB
MP4: 300 kB
AVIF: 274 kB
- janekm 5y agoYes indeed all modern video codecs are based on encoding differences between key frames. GIF has the most basic implementation of that (it can update only a window in the image instead of the whole image). The original GIF can actually be compressed losslessly down to just 1.4MB with a better compressor like https://gifcompressor.com https://gifcompressor.com . MP4 (and similar codecs) are not typically very good at compressing regions of constant colour, while GIF is very good at that. However I have to admit that the output of that converter is acceptable in MP4, better than I would have expected (though noticeably worse quality). BTW curiously (likely to better performance on regions of constant colour) the non-lossy WebP does better on this example coming in at just 1.2MB!
- technobabbler 5y ago2 MB is huge over mobile for a simple graphic illustrating one of many, many features. If you really want to use GIF, it would make more sense to manually create an animation out of frames you define, switching between highlights of that feature, rather than a screen recording that captures every minor, irrelevant animation and follows the hover popup as it moves around a few pixels. That's just a waste of bandwidth. A manually curated GIF of that size could be like 40 kB or so, not megabytes. Otherwise, I'd argue MP4 is by far the superior option for this use case given its far smaller size, where visitors just need to know at a rough glance what a feature does, not examine it for pixel perfection. An imperfect video that loads in 20% of the time is preferable than waiting forever for a huge gif to load.
- janekm 5y agoAs another example the encoder at https://compress-or-die.com https://compress-or-die.com does a quite impressive job at compressing the GIF if allowing some loss of visual quality. Taking the number of colours down to 14 and allowing lossy compression I got the file size down to 386kB: https://compress-or-die.com/gif-process?expert-mode=no&expert-mode=yes&size%5B%5D=373&size%5B%5D=211&start_frame=1&fps=100&colors=14&color_method=blend-diversity&dithering=&lossy=0 https://compress-or-die.com/gif-process?expert-mode=no&exper... I'd consider that a good trade-off given the universal compatibility of GIFs, and no ringing in the decoded video.
- handrous 5y agoAll I know is that when I find an actual gif it's really easy to save and share, but when I find a "gif" that's actually a video, shit never works right. Keep gifs. More gifs, even. Down with videos where gifs would do. Also, raw size isn't everything. What's memory use look like during playback? CPU use? Higher? Spikier? I know there's hardware decoding for common codecs but wouldn't be surprised if videos still use more CPU than gif, in practice.
- brokenmachine 5y agoGifs look like garbage for video though, and take up 10x the space. I'm the opposite. I wish they'd just deprecate gif everywhere and then we'd see better video support. CPU usage shouldn't be an issue for small web video clips on any semi-recent device, my phone records 4k 60fps HEVC HDR10+.
- makeitdouble 5y ago> Gifs look like garbage for video We're speaking of animated graphics, right ? > my phone records 4k 60fps HEVC HDR10+. Reminds me of the rant of one of the Google camera app devs on a podcast, where they tried to see with the android guys if there was any way to just force kill every other app processes while the camera app if on the foreground to guarantee it would have enough resources upfront to do its job. Now playback efficiency should mostly rely on the codec and wether it's hardware supported, but I wonder if there would be a pipeline effect when you're trying to play 25 videos at the same time and they all need to go through the hardware decoder.
- brokenmachine 5y ago>We're speaking of animated graphics, right ? Hmm, wouldn't proper video codecs be better in any case? Whatever settings they use for animated cartoons would be good for animated graphics. I can't imagine a modern codec could be less efficient than gif. >Now playback efficiency should mostly rely on the codec and wether it's hardware supported, but I wonder if there would be a pipeline effect when you're trying to play 25 videos at the same time and they all need to go through the hardware decoder. Hopefully it would stop playing them when they're not visible. But you're right, that is a good question as I doubt the decoders have really been designed with that usage in mind, rather to optimize for a single aforementioned high-res video.