Are short mp4s preferable to gifs for brief animated site elements, or...? - eviltoast

From what I gather, I don’t know that there’s a new norm in this regard yet, besides recognizing that gifs are increasingly old & clunky (despite being fun & amusing), and so I don’t know if mp4s or webms or something else might be better if wanting to keep a site lightweight while still having some animated elements.

  • kornel@programming.dev
    link
    fedilink
    arrow-up
    14
    ·
    1 year ago

    Generally yes.

    GIF’s ancient LZW compression is remarkably ill-suited for modern CPUs, and more expensive than modern algorithms. Combined with significantly larger file sizes, it costs much more to decode, on top of increased costs of transfer and caching.

    GIF might have an edge if the animation is very small (<16px, few frames).

    It also gets messy if you need to play hundreds of animations. GIF will be terribly inefficient, but also browsers aren’t designed to have hundreds of video elements, so both will eat memory in their own way, and it will vary which is worse.

  • Gianni R@lemmy.ml
    link
    fedilink
    English
    arrow-up
    11
    ·
    1 year ago

    WebMs encoded with VP9 or even better AV1 are better than GIFs. Decode speed is negligible, especially considering how much more quickly it will load

  • 𝒍𝒆𝒎𝒂𝒏𝒏@lemmy.one
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    1 year ago

    IMO webm files are ideal as they’re extremely small for the quality of video output. Downside is, they can take a while longer to encode compared to mp4s if your hardware can’t accelerate it

    • spartanatreyu@programming.dev
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      iOS still has issues with webm >_<.

      Best to use a vp9 webm with a h264 mp4 fallback.

      Maybe next decade when the EU creates even more laws, Apple will begrudgingly add av1 support and we can all switch to that.

    • ALostInquirer@lemm.eeOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Basically any animated visual element where in the past you might have used a gif. I’m thinking more for a casual kind of site rather than anything professional, but with a desire for using more up to date formats that are smaller & quicker to load.