How can I limit FFMpeg CPU usage?
Just for peoples who try to find solutions for using in terminal (bash, zsh, or on servers)...
nice -n 20 cpulimit -l 60 -i ffmpeg -threads 1 -i in.avi out.mp4
nice
is program used for setting priority. Read man nice
to know what -n
argument mean at your system. On macOS 20 is lowest and -20 is highest.
cpulimit is open source utility used to control cpu usage (Linux/OS X/FreeBSD).
On MacOS this need sudo.
Check this answer: https://superuser.com/a/214572/458727
I used Battle Encoder Shirasé to throttle down FFMPEG. BES is open-source, so watching its code can help to get an idea.
You can't limit FFMpeg to a percentage of CPU use, but you can set the -threads
parameter on your FFMpeg call, if you have 4 cores try set it to -threads 2
that should limit you to around 50% CPU.
Another solution might be to lower the priority on your FFMpeg process, to something lower than your applications.