Hacker News new | ask | show | jobs
by ComputerGuru 2168 days ago
FYI you can use ffmpeg to encode gif as h264/h265 mp4 videos of varying quality or convert to webm which can be played from an img tag, all of which will be orders of magnitude smaller.

Simplest form: ffmpeg -i foo.gif -c:v libx264 -crf 22 foo.mp4

You can vary crf to change the size to quality trade-off.

2 comments

You know you can give feedback without phrasing a question implying that he already should know that, right?
Not intended as snark, just colloquial. Thanks for the feedback and I've updated the phrasing.
I've replaced most of the gifs with embedded videos. Page loading size is around ~100 mb now
That’s still very unreasonably large and is going to cause real problems for some users, though not as many (and is still going to be uselessly slow to load for many—much of the world, including where large numbers of developers, even SwiftUI developers, are, doesn’t have multi-megabit-per-second speeds). Look, even 20MB is too large. Please, I beg you, just don’t put any GIFs on that page: just make it clear that it’s a video, e.g. by overlaying a circled play icon on the image and making it a link to the relevant video on YouTube.
Ok holy shit. Mp4 compression then converting to gif is the holy grail. 1/3 the original size wtf.