Remix.run Logo
▲ Aldipower 17 hours ago

AVIF consumes around 25 times more CPU during encoding as JPEG. Take this in consideration if you pay for the power consumption. And on the user-facing side, if you upload an images it takes f.ex. 12 seconds (sic!) and not half a second.

▲jeroenhd 17 hours ago | parent | next [-]

12 seconds? It takes 7 seconds on my phone, in a wasm runtime using an older version of the encoder.

From my experience throwing random JPEGs at it, it's 3 to 4 times smaller, that's a good chunk of data saved, which in turn is a lot of energy saved on visitors' radios being active.

Unlike with jpeg, you don't need 85 or 95 percent on the quality score, 50 is more than good enough for most pictures on a website.

If you're hosting images and want a fully lossless encoding the CPU time may become a factor, but if you're hosting user generated content, I don't think it's all that bad. Plus, you can just move the encoding part to the user side of the equation and pretend it's part of the upload progress bar if you're desperate to pay the power bill.

▲Aldipower 16 hours ago | parent [-]

The numbers above coming from a test run on one of my own servers serving and receiving user generated images. It is a Intel E5 56 CPU threads machine with DDR4 RAM. A single thread may be slower then your phone CPU cores, but that's what you find very often when running servers.

▲jeroenhd 10 hours ago | parent [-]

I see, I can imagine a decade old CPU without any kind of video acceleration taking a while indeed. Technology has come a long way since the E5-2690v4.

Still, when encoding AVIF, there are various quality options to choose from, and the encoder has gotten better over the past year. On my i3-2120 NAS (which even your E5 should beat on single core perf), encoding an image at default speed takes about 4-6 seconds (JPEG about 2s), while producing an image of comparable quality a third the size. If I pass --speed 10, converting PNG to AVIF takes only half a second.

The standard AV1 encoder has improved a lot over a short amount of time, I invite you to run another benchmark, you may be surprised.

▲Aldipower 2 hours ago | parent [-]

I am trying to hit a sweet spot between affordability, usability and performance. AVIF fells not in this sweet spot as simple as that. It is cheaper to buy some more (expensive) SSDs, because the images are 20% larger, then to buy new servers, because the encoding is 25 times slower. I am serving images to real users and the servers are in data-center rack. Got it?

▲userbinator 5 hours ago | parent | prev | next [-]

This is also the reason JPEG2000 died off and became a niche format mainly for archival; it's extremely CPU-intensive.

▲brigade 15 hours ago | parent | prev [-]

You can adjust the speed of both, you don't have to use the default of whatever library versions you're using. My cjxl defaults to 2x more CPU than avifenc's default, but I can make it 30x more or 480x less; libaom certainly lets you waste a lot more CPU than libjxl, if that's what you want.

I don't know if anyone has published an encode time / quality comparison of the various encoders. It'd have to be recent to include this year's libaom image optimizations.