You are not logged in.

#1 2026-08-29 14:31:21

rupeshforu3
Member
Registered: 2023-01-06
Posts: 127

how to distribute cpu intense work to all the cores of cpu.

Hi I am Rupesh from India and I have a desktop PC with Ryzen zen3 5500GT processor and asus prime b450 mk2 motherboard. I have installed linux and everything is working fine except I have have a small doubt and I want to clarify it.

Actually My system configuration is as follows

1) Ryzen zen3 5500GT processor which has six cores and 12 threads.
2) my Ryzen zen3 cpu has total 16 mb L3 cache.
3) 16 gb crucial DDR ram with 3200 mhz frequency.


I have some hevc x264 and x265 codec mp4 video files and I want to convert them to av1 codec. I am using ffmpeg tool along with libaom to do this work.


The ffmpeg command I am using is

ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 100k -pass 1 -an -f null /dev/null
ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 100k -pass 2 -c:a libopus -b:a 128k output.mp4

Here ffmpeg tool along with libaom is taking two hours to convert a single 30 minutes x264 or x265 mp4 video file.

I am able to run four instances of ffmpeg I mean I am able to run four ffmpeg commands on four hevc mp4 video files at a time.

Aom encoder has been created by alliance of media to compress the video files to a great extent. If source hevc mp4 video file is 200 mb then the converted or compressed output video file is just 30mb.

This compression takes place entirely in software I mean without any hardware acceleration.

While running four instances of ffmpeg my cpu usage is 80 percent. If I run single instance of ffmpeg my cpu usage is 30 percent.

Now I want to run ffmpeg tool along with libaom with using all the available cpu resources like all the cores and threads and even all the registers, cache present in the processor package.


If I can achieve this I can complete conversion job with in 30 minutes previously 120 minutes.

My goal is instead of running four instances of ffmpeg I want to run a single instance of ffmpeg tool along with libaom which uses all the resources of cpu.


Kindly try to suggest how I can achieve this.

Regards,
Rupesh.

Offline

#2 2026-08-29 15:56:13

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,387

Re: how to distribute cpu intense work to all the cores of cpu.

ffmpeg has a -threads option that tells it how many threads to use for (part of) a job. https://superuser.com/questions/155305/ … by-default has some info .

Although the default is to use as many as the job allows, you can try changing it.

It may also be that libaom doesn't support multithreading (well).

I sometimes recode things to allow my 9 years old tv to display them with this command :

$ ffmpeg -i "$file" -c:v libx265 -vtag hvc1 -c:a aac -ac 2 "1-$file"

It does use all cores/threads my system has available .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2026-08-29 16:12:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,678

Re: how to distribute cpu intense work to all the cores of cpu.

Have you considered searching for a solution or just reading the top of the wiki?
https://wiki.archlinux.org/title/FFmpeg … g_examples

However: ffmpeg usually picks a reasonable number of threads and not all codecs can be reasonably parallelized, https://www.reddit.com/r/AV1/comments/q … threading/
Apparently adjusting the tile amount can help a bit but I'd not expect wonders from that.

Edit: F5ck

Last edited by seth (2026-08-29 16:12:28)

Offline

#4 2026-08-30 05:44:26

rupeshforu3
Member
Registered: 2023-01-06
Posts: 127

Re: how to distribute cpu intense work to all the cores of cpu.

Is it possible to assign 70 percent of CPU resources to a process like ffmpeg and remaining 30 percent to other processes.

Offline

#5 2026-08-30 05:53:11

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,678

Re: how to distribute cpu intense work to all the cores of cpu.

https://man.archlinux.org/man/taskset.1
https://man.archlinux.org/man/nice.1
https://wiki.archlinux.org/title/Cgroups
https://aur.archlinux.org/packages/cpulimit (not used in a long time, iirc I ran into a situation where the sleep just the remaining CPU what kinda defeats the purpose)

Offline

Board footer

Powered by FluxBB