How to I limit CPU usage

HandBrake for Mac support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Locked
niclasc

How to I limit CPU usage

Post by niclasc »

As my other thread was locked without anybody giving me an answer I have to start a new thread

I'm trying to understand how to limit CPU usage in Handbrake.

How do I limit the CPU usage? I dont want to run at 700% - 800% (8 core CPU).

I have a slow network and need to slow down the encoding. PLus I have other things running on my computer that needs the CPU
mduell
Veteran User
Posts: 8207
Joined: Sat Apr 21, 2007 8:54 pm

Re: How to I limit CPU usage

Post by mduell »

You may not be able to depending on your choice in settings.

And you need to post the encoding log for the encode where you claim you had it down to a single CPU, as we've stated repeatedly.

HB can't go faster than your network does, so if it's limited on reading/writing it will only encode as fast as it can get and send data. For giving CPU time to other applications you should use the priority/nice options in the scheduler on your platform.

How are you measuring CPU usage in Linux? In some places in linux "100%" means the same thing as "800%" in some places in OS X.
Deleted User 11865

Re: How to I limit CPU usage

Post by Deleted User 11865 »

There's always renice, but even that only alters the priority.
moneymatt4life
Veteran User
Posts: 440
Joined: Fri Mar 09, 2012 5:26 am

Re: How to I limit CPU usage

Post by moneymatt4life »

have you tried without the colon? :? i know :threads=1 works fine for the wincli, but i'm just curious... as it isn't needed if you're specifying only one option... although, i'd find it funny if that was the problem :lol: so it most likely won't :?

also, you shouldn't be using bob if you're not wanting to double the framerate, your preference though :P
niclasc

Re: How to I limit CPU usage

Post by niclasc »

User avatar
s55
HandBrake Team
Posts: 10360
Joined: Sun Dec 24, 2006 1:05 pm

Re: How to I limit CPU usage

Post by s55 »

Looks like its working fine?

Note, threads=1 only limits the x264 encoder. It doesn't limit HandBrake (decode, filters etc). That means, if the encoder isn't a bottleneck, then you'll still potentially see full CPU usage. There is nothing you can do to change this.

If your case, it seems like you've successfully caused x264 to slow down quite a bit, so your seeing reduced CPU usage.

HandBrake running the CPU at 100% doesn't mean you can't run other applications. Other applications will run fine. Just renice the HandBrake process so it's running at a lower priority and you'll notice next to no slow down in other applications with higher prio.
niclasc

Re: How to I limit CPU usage

Post by niclasc »

Yes threads=1 works fine in Linux as I said in my other thread that was locked for some reason

The thing is that it does NOT work in OSX. If I do the same thing there then the CPU usage is between 700% and 800%
User avatar
s55
HandBrake Team
Posts: 10360
Joined: Sun Dec 24, 2006 1:05 pm

Re: How to I limit CPU usage

Post by s55 »

Then why are you posting a log for linux where it works? That's not helpful.

Why not post a Mac Log so we can see what's actually going on.
niclasc

Re: How to I limit CPU usage

Post by niclasc »

s55 wrote:Then why are you posting a log for linux where it works? That's not helpful.

Why not post a Mac Log so we can see what's actually going on.
mduell asked my to. He said "And you need to post the encoding log for the encode where you claim you had it down to a single CPU, as we've stated repeatedly."
User avatar
s55
HandBrake Team
Posts: 10360
Joined: Sun Dec 24, 2006 1:05 pm

Re: How to I limit CPU usage

Post by s55 »

Nevermind, found it on the other thread.

Given you are using filters. What I said above applies.
Note, threads=1 only limits the x264 encoder. It doesn't limit HandBrake (decode, filters etc). That means, if the encoder isn't a bottleneck, then you'll still potentially see full CPU usage. There is nothing you can do to change this.

If your case, it seems like you've successfully caused x264 to slow down quite a bit, so your seeing reduced CPU usage.
(And no, your not using the same settings between the two. The mac is running intensive multi-threaded filters that your linux encode is not)


So, everything is working as-expected.
Deleted User 11865

Re: How to I limit CPU usage

Post by Deleted User 11865 »

niclasc wrote:Is this OK?

http://pastebin.com/DWZS2az4
Lo and behold, you're using different settings here than in the Mac log you provided in the other thread, despite you insisting you were using the exact same settings.

- different frame rate mode
- different audio encoder
- different deinterlace filter (off here, on under OSX) (mostly likely what's using a lot of CPU on the Mac side)
niclasc

Re: How to I limit CPU usage

Post by niclasc »

s55 wrote:Nevermind, found it on the other thread.

Given you are using filters. What I said above applies.
Note, threads=1 only limits the x264 encoder. It doesn't limit HandBrake (decode, filters etc). That means, if the encoder isn't a bottleneck, then you'll still potentially see full CPU usage. There is nothing you can do to change this.

If your case, it seems like you've successfully caused x264 to slow down quite a bit, so your seeing reduced CPU usage.
(And no, your not using the same settings between the two. The mac is running filters that your linux encode is not)


So, everything is working as-expected.
This is hopeless. Are you not reading? If I do an encoding with normal preset on both Linux and OSX then everything is working fine on Linux but not on OSX. The log from OSX that I provided was with some changes to the normal preset. But I get the same high CPU usage on OSX with the normal preset
niclasc

Re: How to I limit CPU usage

Post by niclasc »

I will repeat my original question.

I'm trying to understand how to limit CPU usage in Handbrake.
How do I limit the CPU usage? I dont want to run at 700% - 800% (8 core CPU).
User avatar
s55
HandBrake Team
Posts: 10360
Joined: Sun Dec 24, 2006 1:05 pm

Re: How to I limit CPU usage

Post by s55 »

Provide a log with an unaltered Normal preset and threads=1

Your either doing something wrong or something is still different and it's impossible to say what.

and my original comment still stands. You can't stop HandBrake using the CPU. Threads=1 *may* bottleneck the encode, it may also not and if it doesn't, your flat out of luck.
mduell
Veteran User
Posts: 8207
Joined: Sat Apr 21, 2007 8:54 pm

Re: How to I limit CPU usage

Post by mduell »

niclasc wrote:Is this OK?

http://pastebin.com/DWZS2az4
Thanks for finally posting this and confirming you're using completely different settings than you chose on OS X as Rodeo noted above.
niclasc wrote:I'm trying to understand how to limit CPU usage in Handbrake.
How do I limit the CPU usage? I dont want to run at 700% - 800% (8 core CPU).
You cannot limit the CPU usage in HB when you choose to use the deinterlace filter.

You could use a third party program like cpulimit to do it, but that's well beyond the scope of this forum.
Deleted User 11865

Re: How to I limit CPU usage

Post by Deleted User 11865 »

niclasc wrote:
s55 wrote:Nevermind, found it on the other thread.

Given you are using filters. What I said above applies.
Note, threads=1 only limits the x264 encoder. It doesn't limit HandBrake (decode, filters etc). That means, if the encoder isn't a bottleneck, then you'll still potentially see full CPU usage. There is nothing you can do to change this.

If your case, it seems like you've successfully caused x264 to slow down quite a bit, so your seeing reduced CPU usage.
(And no, your not using the same settings between the two. The mac is running filters that your linux encode is not)


So, everything is working as-expected.
This is hopeless. Are you not reading?
Yes, it is. You're incapable of providing logs for two encodes (one Mac, one Linux) with the same settings. Bye.
Locked