[FFmpeg-user] How can I reduce the cpu usage of ffmpeg?

Moritz Barsnick barsnick at gmx.net
Sat Jan 10 13:39:46 CET 2015


Hi voip,
in addition to what Andy wrote:

On Sat, Jan 10, 2015 at 10:41:07 +0100, voip at gmx.ca wrote:

> /usr/bin/ionice -c 3 /usr/bin/nice -n 20 /usr/local/bin/ffmpeg -y -i "original_video" -c:v libx264 -b:v 16711680 -pix_fmt yuv420p -c:a copy -c:s copy "converted_video"
> Note that I am running both ionice and nice to give ffmpeg the lowest
> possible priority, yet it still maxes out my CPU.

Software usually doesn't know how not to do that when doing actual
stuff and not idling.

"nice" changes priority (as the name implies), but if there's nothing
else asking for the CPU (or the I/O), your ffmpeg process will still
max it out.

A tool often referenced to is "cpulimit", which is supposed to be able
to do what you are looking for.

Apart from that, Andy's mentioned cpufreq approach seems correct.

> The problem with that is that my CPU temperature rather quickly rises
> from a rather tepid 28 degrees Celsius to a blistering 58 degrees
> Celsius rather quickly (yes, that is a full 30 Celsius degrees
> higher!).

I totally agree with Andy that that doesn't sound horrible, but depends
on the CPU and system of course. But if the system could become
endangered from running full load, it would be a badly designed system.

What's more, Intel CPUs automatically limit themselves if they detect
overheating (e.g. when the cooling is failing). AMD CPUs used to not
have such a feature and could die if the cooler fell off or if your
laptop failed to shut down when you put it in the carry case.

Moritz


More information about the ffmpeg-user mailing list