6 ms·
I'm pretty ignorant of A/V codecs. Can you explain why .gifs are bad and animated .pngs would have been better?
by passivepinetree 9y ago
I'm pretty ignorant of A/V codecs. Can you explain why .gifs are bad and animated .pngs would have been better?
- benjaminjackman 9y agoIf I remember correctly, gifs are palette based and only 256 colors. They also don't have alpha transparency, instead having 1 transparent entry in the palette, so for a gif to smoothly blend into its background it has to be pre-rendered against that background.
- microcolonel 9y agoIn addition to being limited to max. 256 colour palettes and 1-bit alpha (encoded as a palette entry), they only support run-length encoding (Edit: NOT! it's actually LZW) for compression. The combination of RLE (Edit: NOT! It's actually LZW, same point somewhat valid) and dithering (used to overcome the palette colour limitation) results in typical compression ratios which are worse than nothing. Personally I think a hybrid between a video codec (h.264, VP10, etc.) and a lossless transparent still codec (PNG) would be a good way to go
- mcbits 9y agoGIFs use LZW compression, which is the part that was patented. I think the main problem is that the dithering necessary to make 256 colors look good introduces a lot of high-frequency noise, making the compression less effective.
- microcolonel 9y agoOh boy, I don't know how I got the impression that it was RLE. Maybe I was mixing it up with older versions of Targa. Yeah, the noise was more the point I was getting at. IIRC PNG also has the benefit of prefilters which allow it to (and maybe there are other things) compress rectangles as contiguous symbols rather than splitting them across lines, which makes obvious sense for 2D images.
- Houshalter 9y agoIIUC APNGs compress the delta between frames. So 2 frames in a video have mostly similar pixels, and so will compress very well. And even on still images, PNGs have much better compression. From the same principle that nearby pixels usually have similar values. Gifs store every frame as a separate image and use very crude compression. Also the very limited color palette as others mentioned.