$ wget ‘http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz’
$ tar -zxvf cpulimit-1.1.tar.gz
$ cd cpulimit-1.1
# cp cpulimit /usr/local/sbin
cpulimit is a program that helps to limit the CPU usage of a program. It is useful to prevent overheating and subsequent shutdown of your laptop when converting videos from one format to another.
To restrict CPU usage:
1. start your program. In my case this is ffmpeg.
$ ffmpeg -i video.avi -f mp4 -vcodec libxvid -maxrate 1000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -s 320×240 -ab 128 -b 400 -strict experimental video.mp4
Above command converts an avi file to mp4 format for viewing on iPhone. This command does not work as the aac codec is not available on Fedora. Use HandBrake instead.
2. # cpulimit -e ffmpeg -l 30
where 30 = 30% of the CPU.
Limiting to 30% helps me run ffmpeg at a reduced speed and prevents overheating.