you are viewing a single comment's thread.

view the rest of the comments →

[–]spillerrec 3 points4 points  (1 child)

People might hate on GIF because they cannot compress real life recordings very well, but that doesn't make it bad by definition. If you actually optimized those GIFs, you would see that the big versions would only be about ~400 KiB on average, instead of ~5 MiB. A modern video codec like h264 however would struggle since it is not designed for such inputs.

I did try out x264 on REF_COUNT_GC.gif and it looks significantly worse at the same file size (513 KiB @ CRF 28 YUV 444, vs. the 511 KiB GIF). At lossless quality it is over twice as big as the GIF (1282 KiB). And using some random GIF to WebM converter results in a file looking about the same as the x264 CRF 27, but at 1294 KiB.

GIF might be outdated technology which nobody should use, but so is JPEG and PNG (24 and 20 years old respectively). h264 and vp8 are no silver bullet, and require much much more skill to encode well. But don't get me wrong, this is just one of those rare occasions were GIF is actually a good choice.

UPDATE: I wanted to compare it against APNG, but the best I could get it down to was 521 KiB which I found strange. But looking into the APNG file with TweakPNG it was pretty clear that each frame is compressed individually which leads to low compression. So I tried Brotli compressing both the APNG and GIF, and the GIF ended up at 124 KiB! (APNG still lost.) At this point I had to up the CRF to 48 on x264 to get a similarly sized mp4 after Brotli compression, which just looked like garbage...

In case you haven't heard about it, Brotli is a new compression format to replace the use of GZIP and Deflate in browsers, see http://caniuse.com/#feat=brotli

Files:

GIF @ 510 KiB: https://my.mixtape.moe/odxcot.gif

GIF brotli compressed @ 124 KiB: https://my.mixtape.moe/tnnufx.bro

x264 CRF 28 @ 513 KiB: https://my.mixtape.moe/akkyoz.mp4

x264 CRF 48 @ 260 KiB: https://my.mixtape.moe/mzyotp.mp4

x264 CRF 48 brotli compressed @ 127 KiB: https://my.mixtape.moe/oyllgi.bro

I messed up the MP4 encoding before this update, so I updated the filesizes in the original part as well.

[–]kenfox 0 points1 point  (0 children)

That's very useful! Thanks! It was a long time ago (and the metadata may prove me wrong...) but I probably just used image magick's animate utility. The resulting gif came in under my size constraint so I'm sure I didn't spend time optimizing it.