AVIF export extremely slow

The title says it all. Long-time DT user, now decided to see what AVIF has to offer in practice for me and selected an image (8000x4000 px, edited raw file but nothing fancy). I did test this in the distant past (older DT versions, older Fedora Linux version), but that did not work well.

Running this again (different image) on DT 4.2.0 managed to export this image in ~600 s. I know my system is not the fastest (i3-8100, 16 Gb RAM, no OpenCL as only got built-in GPU), but I export JPG, PNG, JPG-XL or WebP in 26-40s for the same image. The resulting AVIF file is smaller than JPG, but 50% bigger than WebP and 2½ times the size of the JPEG-XL file (have not made attempts ant tweaking settings).

This is on Fedora 37; DT is fully functional.

Any suggestions for trouble shooting?

check which AVIF encoder is used on Fedora. this nothing specific to Darktable or at least it shouldnt.

Fedora 37 is on 0.11.1, which it is the latest.

AVIF is slow encoding. Are you using lossless? Try 50% lossy.

There can be different encoders for AV1 in play, but most of them simply are quite slow, specially the older ones (I don’t know how old Fedora 37 is).

AV1 encoding can often go at speeds where we talk in frames-per-minute, not frames-per-second. And that’s for resolutions like 1080p. Encoding a 8000x4000 image is a huge task, specially for older AV1 implementations.

Might just be the way it is. Just did a test with a recent Windows build, on my 14 core Intel 12th gen laptop.
A 4927x3275 image takes (rough estimate) 60 seconds, with the quality set to lossy at 80%.
If I enable the turbo-profile for my laptop, making the fans go louder and letting it run at +/- 100watts, I manage to make it complete in +/- 50 seconds.

For reference, if I export the same image as uncompressed 16bit TIFF as I normally do, it completes in under 2 seconds. So 25x to 30x the effort for encoding to a simple JPG seems about right.

Fedora builds with aom, rav1e and svt support by default. So libavif has probably a default codec and a way to choose which one should be used for encoding.

On openSUSE they decide for you. It is rav1e as it is the most secure one. But rav1e is also one of the fastest. The next thing is that encoding AVIF takes a lot longer then JPEG. JPEG is very old, more than 20 years. AVIF is a modern codec, it requires certain computing power. The only thing which can speed it up is a good processor and tiling. However tiling isn’t suggested for stills.

So it is a trade of. The AVIF export is already heavly optimized in darktable. We could only offer export engine selection but this will make it harder for people to make the right choices.

Not for web export you should not export with something like 90%, AVIF isn’t JPEG! Go with 80% :wink:

I think the default libavif encoder priority is aom->rav1e->svt-av1

Isn’t svt the one finally making av1 encoding better in speed vs result compared to x265?

As in , with aom and rav1e encoding is so slow it just isn’t feasible (although my testing was quite a veel years ago). Svtav1 becoming the new ‘default’ or recommended encoder for av1 was mainly because it is just so many times faster without dropping quality. (Or it uses multiple cores better ).

I would be surprised if rav1e is faster these days while not loosing out in quality .