[FFmpeg-user] How can I reduce the cpu usage of ffmpeg?
barsnick at gmx.net
Sat Jan 10 20:07:25 CET 2015
On Sat, Jan 10, 2015 at 18:44:07 +0000, Nicholas Robbins wrote:
> ( sleep 10s ; cpulimit -z -e ffmpeg -l 95 ) &
> That should start and not wait to finish (a timer of 10 seconds and
> then run the cuplimit command) and then continue on with your script.
I would have suggested that too, or something like suggested here:
though I think there's an error in there.
$ ffmpeg ... & (sleep 2 && cpulimit -z -e ffmpeg -l 95)
Note that I believe the example given in the link requires a double-'&'
after sleep. I use brackets just to go sure.
Even better: cpulimit accepts a PID. If ffmpeg doesn't do crazy fork
magic (which I believe it doesn't), you should be able to tell cpulimit
to pick up ffmpeg's pid. In a Bourne shell, when you background a
process, this PID is stored in "$!".
$ ffmpeg ... &
$ cpulimit -l 95 -p $!
Enough Unix magic (= basics ;-)) for today.
More information about the ffmpeg-user