Remix.run Logo
▲ Metricon 4 hours ago

AVIF is fantastic format and I use it in my production applications. Spent quite a bit of time looking to the best settings (at least for up to 2k images) and for anyone interested in converting images to AVIF, here's what I've found to work the best for creating the smallest size (10x+ smaller) while still retaining good quality and even supports PNG transparency:

  ffmpeg -i {input_file} -filter_complex "[0:v]format=pix_fmts=yuva444p,split[color][alpha];[alpha]alphaextract[alpha_chan]" -map "[color]" -map "[alpha_chan]" -c:v libaom-av1 -crf 25 -cpu-used 3 -still-picture 1 -aom-params "sharpness=2:enable-chroma-deltaq=1:arnr-strength=0" -color_range pc -colorspace bt709 -color_primaries bt709 -color_trc bt709 {output_file}
▲jaffathecake 4 hours ago | parent | next [-]

Hmm, I haven't tested this, but I'm deeply sceptical. avifenc is now optimised very well for still images, and you're bypassing all of that here.

▲Metricon 4 hours ago | parent [-]

These settings have worked very well for me so far, but if you are aware of even better settings, I'd certain like to give it a try.

▲jaffathecake 3 hours ago | parent [-]

avifenc. The latest version.

▲Metricon 3 hours ago | parent [-]

Ah, I actually wasn't aware that "avifenc" was a separate executable. Thanks for the information. I will definitely do some comparison testing.

▲theandrewbailey 3 hours ago | parent | next [-]

It's part of libavif. I've usually compiled it myself.

https://github.com/aomediacodec/libavif

avifenc supports args like enable-chroma-deltaq. I've used those but recently stopped, and nothing substantial changed.

▲ 3 hours ago | parent | prev [-]
[deleted]
▲LewisOrton 2 hours ago | parent | prev [-]

in my app i was using jpeg but then switched to webp two years ago, they're for generating/displaying thumbnails for images and videos. and now avif seems like a better fit? anything that you're not happy about? considering avif now, appreciate any ideas

▲Metricon 32 minutes ago | parent [-]

If you're working with images that need to be lossless or are simple in color diversity, WEBP is probably still a better choice (though not by a large margin). The biggest issue you might run into with AVIF is legacy support, particularly amongst Apple devices who were slower to implement support for it.

Otherwise the massive size reduction for storage and transfer speeds makes it incredibly attractive for modern web applications.

▲LewisOrton 11 minutes ago | parent [-]

it's a desktop app so i dont see any reason not to use avif, thanks!