Ubuntu, Windows – Limit CPU usage. Control that bully. + Ipod tip.

I do a lot of video and audio conversion for my Ipod. And almost aways, my conversion program (ffmpeg), hogs up my CPU for the entire time with 100%CPU and manages to heat it upto 80 degrees (C). I have seen as high as 85.

Finally, thought there must be some ways of handling it apart from just nicing it or renicing it. Here are the tools I found out.


Well, I always had this applet “CPU Frequency Scaling Monitor” through which I can run my processor at specified frequencies. But that never impressed me. As this just slows my processor, the bully process still hogs it leaving other processes thirsty. Of course, this is helpful for controlling temperatures if I am doing a long video or a movie. But definitely not my type.

Oh, If you are wondering about the frequency selector thing, it isn’t available by default. Follow this link, to enable frequency selecting. Just click on applet and chose your frequency. Again this might be just available for laptop processors. (?) But I don’t see the point here running your power house at lower speeds.

Anyways, what ever I was looking for Synaptic had it. 😀 Its a small cutely cudly thingy proudly called “cpuLimit”. Just grab a terrminal and install it. sudo apt-get install cpulimit 🙂

I don’t know how it does it neither I could find out. It could be dynamically *nicing* the process to achieve average percentage CPU usage for small time slices. The *limiting effect* is pretty instantaneous. Anyways, all I have to do is,

sudo cpulimit -p pid -l 25

.. and the busy bully just tamely runs at 25% CPU. ZZZactly, what I wanted. CPU runs at normal speeds. (I use OnDemand). Other processes get the water they need, Everyone’s happy. Me too. Movie getting converted at 15% CPU on 4th workspace as my amarok plays BT and I writes my blog.

Anyways, Here’s the cuty.


Being a windoos user at Office, looked up some tools for Windows as well.

iPod Tip of the Day

Slow and best:
ffmpeg -i videoFile1.avi -f mp4 -vcodec libxvid -maxrate 1500k -b 1150k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -g 300 -ar 48000 -ab 192k -s 640x352 -aspect 16:9 Output.mp4

Fast and Simple:
ffmpeg -i temp.avi -ab 292k -ar 44100 -b 2000k -r 25 -s 640x480 temp1.mp4


7 Responses to “Ubuntu, Windows – Limit CPU usage. Control that bully. + Ipod tip.”

  1. Anonymous Says:

    wonderful. ipod trick is good and best among all is the cpulimit tool discovery..

  2. px Says:

    thanks, so useful.

  3. Avinash Says:

    man….u made my day…seriously a hugeeeee THANKS!

  4. Bryan Klumpp Says:

    For Windows you can also set the priority lower in Task Manager; seems to work for me

  5. Ayush Rai Says:

    I do what Bryan does. Why so much trouble when it’s an inbuilt option? I haven’t tried but maybe you get more with those apps…

  6. TYPEMOON Says:

    Bryan, priority is not the same as CPU limit. A task will use 100% of the CPU even if it has the lowest priority as long as not other task is using CPU time.

  7. prupert Says:

    This is brilliant, exactly what I wanted to reduce the load on my streaming server (for a baby webcam monitor). I wonder how low I can get the load without messing the stream up.

    Great little find and great post – cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: