This project has moved and is read-only. For the latest updates, please go here.

Set CPU Core Affinity for Handbrake

Nov 11, 2012 at 5:17 PM

I'm really pleased with the recent fixes that have been done.  I'm having a problem with Handbrake now running the temperature of my CPU way up.  I've been able to control it by manually setthing the affinity of the process.  I'm wondering if anyone could point me in the right direction to set affinity  with the start command on all executions of handbrake.  I haven't programmed in 20 years and my scripting experience on windows is very limited.  Any help would really be appreciated.

 

Nov 29, 2012 at 5:35 PM

Let me try this with a more specific question.  I've found that you can replace the handbrakecli.exe with a .bat file that runs:

start /affinity 240 C:\Program Files\MCEBuddy2x\handbrake\handbrakecli.exe

I think MCEBuddy is calling directly to the executable.  Is the location (and program) for handbrake configurable in MCEBuddy anywhere?  (So I can call to the .bat file)

It just struck me that the args would have to be passed in the .bat file (which I'm not certain of the syntax).

Anyone? Anyone?...

Thanks!

Dec 3, 2012 at 6:01 PM

Here's how you can do it,

1. Rename handbrakecli.exe to handbrake.exe in the MCEBuddy folder

2. Create a batch file with the above command and change handbrakecli.exe to handbrake.exe (add %* at the end of the command line to pass ALL the parameters)

start /affinity 240 "C:\Program Files\MCEBuddy2x\handbrake\handbrake.exe" %*

3. Convert the batch file to a exe file using

Option A - Advanced Batch to Exe converter - http://www.battoexeconverter.com/downloads/advbattoexe.exe

Option B - Use Windows IExpress tool - http://renegadetech.blogspot.com/2006/07/how-to-convert-bat-file-or-vbs-file.html

 

Both are free.

 

Name the executable generated from the above tools as handbrakecli.exe and place it in the MCEBuddy folder.

Jan 22, 2013 at 2:58 PM

MCEBuddy now supports CPUAffnity, refer to documentation for more details.

Jan 22, 2013 at 8:55 PM

Thats excellent.  I'd like to try the beta.  Can two versions be run on 1 machine?  If not, I can test on another.  Thanks for the excellent work you are doing on this!

Jan 22, 2013 at 9:06 PM

No, only 1 on a machine. read the discussion thread for Early Access for BETA

Jan 22, 2013 at 9:18 PM
Edited Jan 23, 2013 at 10:22 PM
thanks, thats what i thought...
 
If you would please set me up for the early access...
 
 
 
Ben Miller

From: rboy1 [email removed]
Sent: Tuesday, January 22, 2013 3:07 PM
To: benm1@verizon.net
Subject: Re: Set CPU Core Affinity for Handbrake [mcebuddy2x:402773]

From: rboy1

No, only 1 on a machine. read the discussion thread for Early Access for BETA

Jan 23, 2013 at 11:12 PM

I've been trying the CPUAffinity=integer command and everytime I set it, when the server runs, it resets the value back to 0.  I was trying to understand the way you implemented this.  Microsoft uses (in the case of the I7 which has 8 cores) bitmap values such that 1 enables core 0, 2 enables core 1, 4 enables core 2, etc.   So if I wanted to enable cores 4,5,6,7 I would use a bitmask of 240 (128+64+32+16).  If I'm misunderstanding this, could you please clarify?

Thanks again.

Jan 24, 2013 at 12:53 AM

your calculations are correct, it's based on the same logic.

 

However I hope you've read the documentation carefully. When you click STOP MCEbuddy writes the EXISTING configuration back to the file.

When you click START it reads the configuration from the file.

 

So if you're making changes without clicking stop you will lose your changes.

Click, Stop, make the changes, click Start.

Jan 24, 2013 at 12:56 AM
Ok, I thought I had stopped it but that must explain it. Thanks yet again!


From: rboy1 [email removed]
Sent: Wednesday, January 23, 2013 6:54 PM
To: benm1@verizon.net
Subject: Re: Set CPU Core Affinity for Handbrake [mcebuddy2x:402773]

From: rboy1

your calculations are correct, it's based on the same logic.

However I hope you've read the documentation carefully. When you click STOP MCEbuddy writes the EXISTING configuration back to the file.

When you click START it reads the configuration from the file.

So if you're making changes without clicking stop you will lose your changes.

Click, Stop, make the changes, click Start.