MP&XnConvert: No multi-threading when encoding AVIF

*** Please report new bugs here! ***

Moderators: helmut, XnTriq, xnview, Dreamer

Post Reply
User avatar
Stock
Posts: 45
Joined: Wed Oct 12, 2022 3:33 pm

MP&XnConvert: No multi-threading when encoding AVIF

Post by Stock »

Creating an avif takes a looong time.
To show what I mean, I'm converting a big 3000x3000 picture from jpg to avif using an AMD 5600X 6-core/12-thread processor.
Here are my conversion settings:
avif multi bug settings.png
avif multi bug settings.png (19.51 KiB) Viewed 1562 times
Multi-threading is selected and set to use all 12 threads.

Here are the results:
time1.png
time1.png (10.59 KiB) Viewed 1592 times
The whole affair took 1 minute and 5 seconds (sic!)
but during the entire time, the CPU never went above 9% load.

To confirm, I ran it one more time with multi-threading turned OFF:
time2.png
time2.png (10.23 KiB) Viewed 1578 times
...and it took the very same 1 minute and 5 seconds.


A friend of mine used AOM's libavif and was able to successfully multi-thread the encoding.
With his 4-core/4-thread Phenom processor he cut down the required time by almost 75% after adding the

Code: Select all

--jobs
parameter. See also: https://web.dev/compress-images-avif/
Speeding up the encoder
One parameter that may be good to change depending on how many cores you have on your machine is the --jobs parameter. This parameter sets how many threads avifenc will use to create AVIF images. Try running this at the command line. [...]
[Using] 8 threads when creating the AVIF image [...] speeds up AVIF encoding by roughly 5x.
Imagine that: five times as fast! For my example picture, encoding time would go down from 65 seconds to just 13 seconds!

If anything needs multi-threading, it's AVIF.
use ALL the threads.jpg
Last edited by Stock on Thu Feb 16, 2023 5:39 pm, edited 17 times in total.
cday
XnThusiast
Posts: 4396
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: MP&XnConvert: No multi-threading when encoding AVIF

Post by cday »

You presumably have multi-threading selected on the Output tab?
User avatar
Stock
Posts: 45
Joined: Wed Oct 12, 2022 3:33 pm

Re: MP&XnConvert: No multi-threading when encoding AVIF

Post by Stock »

cday wrote: Thu Feb 16, 2023 1:32 pm multi-threading selected?
Attachments
avif multi bug settings.png
avif multi bug settings.png (19.51 KiB) Viewed 1561 times
cday
XnThusiast
Posts: 4396
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: MP&XnConvert: No multi-threading when encoding AVIF

Post by cday »

Alles klar... :wink:
User avatar
masterjp
Posts: 471
Joined: Fri Feb 13, 2009 4:37 pm
Location: Duesseldorf, Germany

Re: MP&XnConvert: No multi-threading when encoding AVIF

Post by masterjp »

You are funny.

XnViewMP Multi-threading setting use many CPUs cores, but it is important to convert more than 1 file. :)
PC: Intel 8700k + Asus Z370-F + 16 GB RAM G.Skill + Asus RTX 3050 OC + Samsung SSD
OS: Windows 10 Pro 64bit 22H2 |
GFX: XnViewMP 1.8.7 | XN-View 2.52.0 | XnConvert 1.104.0 | Adobe Photoshop Elements 2024 | Elements XXL 11 | Paint.Net 5.1.7
User avatar
Stock
Posts: 45
Joined: Wed Oct 12, 2022 3:33 pm

Re: MP&XnConvert: No multi-threading when encoding AVIF

Post by Stock »

masterjp wrote: Fri Feb 17, 2023 9:56 am You are funny.
Thanks.

Avifenc can multi-thread the encoding of a single file.
If the functionality is already included and ready to be unleashed simply by slapping the --jobs parameter on it, why not go for it?

As I've shown, there are huge savings in encoding time to be had and most of the time I don't have 12 files at hand, but only a couple of files.
Post Reply