[HN Gopher] How to GIF (2025 Edition)
       ___________________________________________________________________
        
       How to GIF (2025 Edition)
        
       Author : speckx
       Score  : 27 points
       Date   : 2025-02-06 01:23 UTC (2 days ago)
        
 (HTM) web link (fullystacked.net)
 (TXT) w3m dump (fullystacked.net)
        
       | asimpletune wrote:
       | Basically use webp if you want to have the fewest problems while
       | still retaining the majority of benefits out there. Good
       | compression, works across most devices, and unexpected pitfalls
       | like animating transparency aren't an issue.
        
         | vbernat wrote:
         | The article is surprisingly inconclusive. From my
         | understanding, the easiest way is to use the <video> tag with
         | mp4.
        
           | asimpletune wrote:
           | <video> and mp4 can also work well. As a GIF replacement, the
           | initial differences are minor because you can easily add loop
           | and autoplay to the video's attributes, and both work with
           | most browsers' reader modes. From my tests, though, video-as-
           | GIFs isn't a feature supported by the major RSS readers,
           | while WebP works without any issues.
           | 
           | Anyways, the real insurmountable problem is animations with
           | transparent backgrounds. There's no good way to do this in
           | mp4, and WebP seems to be the only format that does it well.
           | But because of all the little pains, headaches, and surprises
           | that can arise due to subtly different use cases, I still
           | think WebP is the format that will give you the most benefit
           | with the least drawbacks for silent animated images. Even
           | without having transparent backgrounds as a requirement.
        
           | vunderba wrote:
           | Agreed with the MP4 recommendation. As I mentioned in another
           | thread, animated WebP can have frame-rate issues on Safari...
           | but if you want autoplaying videos _with_ transparency it 's
           | pretty much the only game in town.
           | 
           | If you don't need transparency, I would 100% stick with mp4.
           | Just make sure you set the tag elements "autoplay loop
           | muted".
           | 
           | Mobile Safari used to be pretty weird. If you wanted autoplay
           | (and _NO_ controls), you needed to make sure to remove the
           | audio channel on the video. Setting the  "muted" attribute
           | wasn't enough.
        
           | Lammy wrote:
           | Pardon my pedantry but MP4 is just the container and does not
           | spare you from finding a compatible set of codecs to put in
           | that container that will play on your target browser-plus-OS
           | combo. See the video and audio codec table here for example:
           | https://developer.mozilla.org/en-
           | US/docs/Web/Media/Guides/Fo...
        
       | ghxst wrote:
       | Are the features and codecs safari doesn't support part of
       | WebKit? If so does that mean that any browser on iOS doesn't
       | support it either?
       | 
       | Also, the article links to a blog post[0] about video with
       | transparency, and although the performance is the main complaint
       | I had no idea this was a thing! Worth the read if you enjoyed the
       | article I think.
       | 
       | [0] https://jakearchibald.com/2024/video-with-transparency/
        
         | koakuma-chan wrote:
         | Every browser on iOS is WebKit unless you're from EU.
        
           | ghxst wrote:
           | Yeah that's my point, but I'm not sure if codec support is
           | implemented outside of that.
        
             | koakuma-chan wrote:
             | Nope, it's implemented in the browser engine. I honestly
             | find it funny that, for example, Opera, Edge and Chrome are
             | supposedly different browsers, even though it's all
             | actually Chromium and there is no meaningful difference.
        
       | seqizz wrote:
       | I re-encoded all of my webm's to mp4's back then on my "gif
       | blog", thanks to Safari and all my mac-using friends saying "I
       | can't see it". Now look who started to support it eh.
        
       | autoexec wrote:
       | Replacing gifs with video files does come with an increased the
       | risk of malware being spread. If it gets common to stuff webpages
       | full of video files we should expect to see an increase in the
       | use of malicious video files to do bad things.
       | 
       | In my case, as someone who doesn't allow javascript by default
       | and prevents media from playing automatically the only image on
       | that entire page that loaded for me was dancingbaby.webp
       | 
       | Everything else (if it showed up at all) displayed as generic
       | blocked elements I'd have to click on to view (or right click to
       | download) so if that catches on websites that are currently busy
       | with gifs should load a lot faster and look a lot cleaner. That's
       | a plus.
        
         | areyourllySorry wrote:
         | i don't understand how one thing leads to another. if anything,
         | a popular feature (videos) is more protected against 0days as
         | there's more eyes on it, not the opposite. what else could a
         | "malicious video file" be, a cognitohazard? i am aware of the
         | facebook tails video 0day but that's not a browser issue, nor
         | is it a common issue
        
           | autoexec wrote:
           | > if anything, a popular feature (videos) is more protected
           | against 0days as there's more eyes on it, not the opposite.
           | 
           | It's usually the opposite. The more common something is, the
           | more likely attackers are to target that thing. Adobe acrobat
           | was a prime target for malicious PDF files because it was
           | what everyone used. Once browsers started displaying PDF
           | files attackers turned their attention there.
           | 
           | Ultimately every exploit that gets discovered does result in
           | increased security, as bad code gets patched, but there's no
           | shortage of bad code and even long lived codebases get new
           | flaws discovered all the time.
           | 
           | > what else could a "malicious video file" be, a
           | cognitohazard?
           | 
           | malicious video files usually target whatever software
           | processes them.
           | 
           | Here are some other examples:
           | 
           | https://nvd.nist.gov/vuln/detail/CVE-2023-6351
           | 
           | https://nvd.nist.gov/vuln/detail/CVE-2024-13156
           | 
           | https://nvd.nist.gov/vuln/detail/CVE-2023-29341
           | 
           | https://nvd.nist.gov/vuln/detail/CVE-2023-6879
           | 
           | https://nvd.nist.gov/vuln/detail/CVE-2024-57510
           | 
           | https://nvd.nist.gov/vuln/detail/CVE-2022-2566
           | 
           | https://nvd.nist.gov/vuln/detail/CVE-2020-11184
        
         | binaryturtle wrote:
         | Time to block webp by default too. It's still a way too
         | immature format to be relied upon. In fact it already was
         | exploitable (via libwebp), AFAIR. :^)
        
         | Lammy wrote:
         | Weird to see this downvoted since this has actually happened:
         | https://nvd.nist.gov/vuln/detail/cve-2023-4863
         | 
         | WebP might support GIF-like animation, but since it's just one
         | feature of an incredibly-complicated codec it invites a huge
         | attack surface with extremely wide range since 99% of people
         | will use libwebp. GIF89a on the other hand is simple enough
         | that lots of people can write a working decoder.
        
           | autoexec wrote:
           | It's happened multiple times over a large number of formats.
           | Even gifs have been exploited
           | (https://www.zdnet.com/article/whatsapp-vulnerability-
           | exploit...), but just as you said it's the complexity of
           | video that makes it more difficult to keep secure.
        
       | lxe wrote:
       | Unless I can right click (or long press) and copy or save and
       | then paste somewhere else, I don't want it.
        
       | vunderba wrote:
       | The site claims that animated WebP might be fully supported - but
       | while writing a Obsidian-to-Static site exporter that would
       | compress animated GIF file to animated WebP, I found that Webkit-
       | based browsers seem to struggle with fluid playback particularly
       | on iOS.
       | 
       | Example here:
       | 
       | https://gondolaprime.pw/animation-test
        
       ___________________________________________________________________
       (page generated 2025-02-08 23:00 UTC)