HandBrake CPU affinity resets after each video

HandBrake for Windows 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.
Post Reply
wtfiwinomgs@yahoo.ca
Posts: 9
Joined: Sun Feb 02, 2020 7:16 am

HandBrake CPU affinity resets after each video

Post by wtfiwinomgs@yahoo.ca »

Description of problem or question:
HB CPU affinity resets after each video in queue



Steps to reproduce the problem (If Applicable):
open up handbrake, load up a source and finish settings and encode. using cpu meter see all cores used, bring up task manager go to HB affinity and set it to less cores. encoding finish, next video uses all core without restarting handbrake.exe



HandBrake version (e.g., 1.0.0):
1.3.0



Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
windows 8



HandBrake Activity Log ***required*** (see How-to get an activity log)
just cleared the log before making this post, so no log. also a log would mean me encoding at least one 4 hours long video and i'd rather not do that again, unless there is a much shorter video to finish within seconds to repeat this. many software have feature to let users choose how many threads it can use, can handbrake include such feature as well will be great.

Code: Select all

Please replace this text with the contents of your log file between the two code tags - OR -  provide a pastebin URL in place of these 3 lines.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: HandBrake CPU affinity resets after each video

Post by s55 »

HandBrake has no code to change CPU affinity settings. Only priority. There must be something external of HandBrake that's tampering with the process.
wtfiwinomgs@yahoo.ca
Posts: 9
Joined: Sun Feb 02, 2020 7:16 am

Re: HandBrake CPU affinity resets after each video

Post by wtfiwinomgs@yahoo.ca »

s55 wrote: Sun Feb 02, 2020 11:30 am HandBrake has no code to change CPU affinity settings. Only priority. There must be something external of HandBrake that's tampering with the process.
thank you for replying.

I understand currently theres no such code/settings to do it, basically when encoding videos thats over few minutes long means user can't really use computer at all as it is fully stressed. If I have a 32 cores thread ripper would help but until I buy that, 8 core 9700k should be more than enough but I'd need to adjust affinity after each and every video.

setting up affinity doesn't even work as it'll just reset, possible to find out why? also would HB team please consider adding it in the future?
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: HandBrake CPU affinity resets after each video

Post by s55 »

setting up affinity doesn't even work as it'll just reset, possible to find out why? also would HB team please consider adding it in the future?
It's something about your environment so it's not something we can look into. This doesn't happen for most people.

We already have the Process Priority dropdown in the settings. There should be no need to set affinity directly. At "Low" HandBrake virtually grinds to a halt to allow other applications to utilise the CPU.
Deleted User 13735

Re: HandBrake CPU affinity resets after each video

Post by Deleted User 13735 »

For years, we didn't multitask or play games on our editing computers, because we couldn't get any production done.

It was a different kind of "priority" for us who needed to make money as producers.

So having "some" multitasking ability in 2020 is a luxury, not any entitlement, and honoring that notion would put an end to all the competitive issues over cores and threads, which are really just crossed purposes.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: HandBrake CPU affinity resets after each video

Post by rollin_eng »

If you change the affinity BEFORE you start the encode(s) does it stick?
wtfiwinomgs@yahoo.ca
Posts: 9
Joined: Sun Feb 02, 2020 7:16 am

Re: HandBrake CPU affinity resets after each video

Post by wtfiwinomgs@yahoo.ca »

rollin_eng wrote: Tue Feb 04, 2020 6:16 pm If you change the affinity BEFORE you start the encode(s) does it stick?
it only stick to the first video in the queue. every succeeding video setting will not apply to them.
wtfiwinomgs@yahoo.ca
Posts: 9
Joined: Sun Feb 02, 2020 7:16 am

Re: HandBrake CPU affinity resets after each video

Post by wtfiwinomgs@yahoo.ca »

musicvid wrote: Tue Feb 04, 2020 4:22 pm For years, we didn't multitask or play games on our editing computers, because we couldn't get any production done.

It was a different kind of "priority" for us who needed to make money as producers.

So having "some" multitasking ability in 2020 is a luxury, not any entitlement, and honoring that notion would put an end to all the competitive issues over cores and threads, which are really just crossed purposes.
its 2020, and i'd agree in prior days computer didnt have the capability as most consumer and even work station caps out at 6-8 cores. I just bought 64 cores TR recently for my new rig and honestly running it at 60 cores vs 64 cores makes little to no difference. what is different it does make is not browsing without lag/delay because I can leave 2-4 cores for other uses.

you can continue to argue we users are taking it for granted, i simply disagree and I think you should not tell user how they wish to use their computer. implement a useful feature should be the norm, and theres clearly a problem and imo its just an excuse to not fix it.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: HandBrake CPU affinity resets after each video

Post by mduell »

You haven't explained why setting priority (which both HB and Windows Task Manager can do, and sticks) is insufficient and/or you want an affinity setting instead. Doesn't make any sense. Sometimes users don't know what's actually good for them.
wtfiwinomgs@yahoo.ca
Posts: 9
Joined: Sun Feb 02, 2020 7:16 am

Re: HandBrake CPU affinity resets after each video

Post by wtfiwinomgs@yahoo.ca »

mduell wrote: Tue Feb 11, 2020 11:18 pm You haven't explained why setting priority (which both HB and Windows Task Manager can do, and sticks) is insufficient and/or you want an affinity setting instead. Doesn't make any sense. Sometimes users don't know what's actually good for them.
explain what? I dont create windows nor do I create HB.

all I know is, once i set affinity to less cores and encode for a queue that has multiple videos, it will only do that affinity to the first video. I have no such problem with other software in windows when i set affinity they will stay, till it is restarted.

what does not make sense is why other software work and only HB doesn't work.
akyhne
Posts: 26
Joined: Sat Feb 08, 2020 1:02 am

Re: HandBrake CPU affinity resets after each video

Post by akyhne »

You can make a custom shortcut to start up HB, allowing it to use only specific cores and threads.

The link looks like this:
C:\Windows\System32\cmd.exe /c start "Handbrake" /High /Affinity 55 "C:\Program Files\HandBrake\HandBrake.exe"

The number after /affinity (55) decides which cores/threads to use.
You have a 32 cores, 64 threads CPU?

If you want the HB software to use core 0, 2, 4, and 10? This would be written in binary as 10000010101 (Core 0 is the first from the right).
Put the number in a hex editor and you get the number 415. Replace 55 with 415.

If you want the HB software to use core and thread 0-15? This would be written in binary as 1111111111111111 (Core 0 is the first from the right).
Put the number in a hex editor and you get the number FFFF.

The number would be FFFFFFFF (8f's) to use half your CPU.

I've tested this on an Intel 4790K CPU with 4 cores/8 threads. It works and it works encoding 3 files in a row in a queue.
As it is just a shortcut, you can make several shortcuts for various tasks, where you want more or less cores free for other stuff.
AS it is a shortcut to the command prompt, the icon will be incorrect, but you can just edit the icon after creation.

PS: I don't know what /High does, but I would guess it sets the priority of the software.
wtfiwinomgs@yahoo.ca
Posts: 9
Joined: Sun Feb 02, 2020 7:16 am

Re: HandBrake CPU affinity resets after each video

Post by wtfiwinomgs@yahoo.ca »

akyhne wrote: Wed Feb 12, 2020 2:44 pm You can make a custom shortcut to start up HB, allowing it to use only specific cores and threads.

The link looks like this:
C:\Windows\System32\cmd.exe /c start "Handbrake" /High /Affinity 55 "C:\Program Files\HandBrake\HandBrake.exe"

The number after /affinity (55) decides which cores/threads to use.
You have a 32 cores, 64 threads CPU?

If you want the HB software to use core 0, 2, 4, and 10? This would be written in binary as 10000010101 (Core 0 is the first from the right).
Put the number in a hex editor and you get the number 415. Replace 55 with 415.

If you want the HB software to use core and thread 0-15? This would be written in binary as 1111111111111111 (Core 0 is the first from the right).
Put the number in a hex editor and you get the number FFFF.

The number would be FFFFFFFF (8f's) to use half your CPU.

I've tested this on an Intel 4790K CPU with 4 cores/8 threads. It works and it works encoding 3 files in a row in a queue.
As it is just a shortcut, you can make several shortcuts for various tasks, where you want more or less cores free for other stuff.
AS it is a shortcut to the command prompt, the icon will be incorrect, but you can just edit the icon after creation.

PS: I don't know what /High does, but I would guess it sets the priority of the software.
yes i have already tried that and I thought setting would stick for rest of the videos in queue. similar problem occurs, only first video gets that affinity setting and any subsequent video uses all cores instead of the affinity I set for shortcut.
akyhne
Posts: 26
Joined: Sat Feb 08, 2020 1:02 am

Re: HandBrake CPU affinity resets after each video

Post by akyhne »

Worked for me.

Maybe check the Windows log.
Post Reply