• AdrianTheFrog
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 days ago

    yeah you can just ffmpeg -i video.mkv -c:v copy video.avif and it will copy over the av1 stream without reencoding

    https://copyparty.adrian.place/u/tower.avif (1.5 mb animated avif)

    interestingly you can’t do this with webp even though that is also built on a video codec, webp only supports intra frames so it can’t take advantage of the similarities between multiple frames of a video the way avif can

    av2 also came out recently, it’s a fair amount better but there isn’t really a usable encoder yet (the encoder they made to test the codec, avm, is unusably slow, but they designed the codec for fast software and hardware encoders to be possible)

    • AdrianTheFrog
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 days ago

      nowadays, for practical use, generally avif is best for lossy images (make sure you’re using a recent encoder so you get the new tune=iq, which is default in libavif since this March) and webp is best for lossless.

      for lossless, if you don’t care about wide support, jpeg xl lossless is usually best, outside of some niche high-speed focused codecs with even less support (like https://github.com/a1024/L1codec).

      for lossy, av2 is probably the best, though it’s currently extremely slow to encode and supported by nothing, but that will probably change relatively soon. It looks like av2 will use the same avif container and file extension for images.

      there are also proprietary and/or patented codecs that I’m not as knowledgeable about (including x265 and x266, which are covered by many patents but have open-source encoders and decoders). My understanding is that x265 is roughly equivalent to av1 quality (or maybe a bit below) and x266 is roughly equivalent to av2. x266 might be able to compress a bit more than av2, but it seems like it might not be feasible to get encoding to be reasonably fast, as that doesn’t seem to have happened over the past 6 years it’s been out. The only devices I know of with hardware decoding support for x266 are Intel xe2 or xe3 GPUs (b60, b580, b390, etc)

      • ikt
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        3 days ago

        wth https://aussie.zone/post/34604587 why doesn’t it play on mobile??

        edit: FFmpeg tags HEVC streams in MP4 as hev1 by default, Apple only supports hvc1 for some reason.

        You need to add -tag:v hvc1 to your command line.

        In my case ffmpeg -i ok.mp4 -c:v libx265 -tag:v hvc1 -c:a aac -movflags +faststart output.mp4

      • ikt
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 days ago

        funnily enough I discussed with my mate Mistral Le Chat about JXL vs AVIF and was like, why use AVIF over JXL, and it was like JXL is better but AVIF has more support, but WebP has even more support than both of them and decent compression

        So I ended up going with webp for my self hosted vibe coded image host

        Basically I’m now just waiting for everyone to catch up so I can go to JXL over WebP

        • AdrianTheFrog
          link
          fedilink
          English
          arrow-up
          2
          ·
          5 days ago

          It’s more competitive at the high end, but this website has some comparisons of avif and jxl: https://svt-av1-psy.com/avif/

          (this project was later incorporated into other encoders as tune=iq, and is now default)

          That being said, I think the jxl bitstream does have a fair amount of potential that current encoders don’t exploit due to lack of manpower. I’ve been following development fairly closely over the past couple years on the jxl discord, I think all active jxl devs are there