logoalt Hacker News

Metricon • today at 6:11 PM • 2 replies • view on HN

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}

Replies

jaffathecake • today at 6:40 PM

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.

➕ show 1 reply
LewisOrton • today at 8:45 PM

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

➕ show 1 reply