Handbrake Ignoring Affinity Settings Before/After Encode

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
dpk
New User
Posts: 1
Joined: Thu Nov 29, 2018 3:46 pm

Handbrake Ignoring Affinity Settings Before/After Encode

Post by dpk »

Description of problem or question:

Handbrake ignores the set affinity ex: 2 of 8 threads before the encode has begun. When the encode is started I can then go in and lower the thread usage to <8 but each item queued will reset the thread usage back to 8 when it moves onto the next

Steps to reproduce the problem (If Applicable):
  • Open Handbrake and set the affinity via task manager
  • Start an encode and it begins using all available threads on the system rather than what was specified previously
  • Change affinity again, with the process scaling down appropriately
  • Next item in queue starts, same issue and steps to solve.
HandBrake version (e.g., 1.0.0):

v1.1.2 64bit


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

Windows 7 Home Premium 64bit

HandBrake Activity Log ***required*** :

https://pastebin.com/2nwkUHiH
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Handbrake Ignoring Affinity Settings Before/After Encode

Post by s55 »

I can't reproduce this.

Since we don't set affinity, only priority, it's something outside of HandBrake that is affecting this.

So once set, HandBrake can't choose to ignore it. It's down to Windows to properly schedule the applications threads.
Note, setting affinity doesn't mean HandBrake will use 2 threads. It'll still probably spawn a dozen or more. This is the correct behaviour. It's up to the operating system to schedule those threads on the defined cores.
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Handbrake Ignoring Affinity Settings Before/After Encode

Post by Woodstock »

When an encode finishes, the next encode is treated as a separate process by Windows, so the affinity setting of the old one is gone.

You need to set the affinity for the handbrake.exe program before you start it, which will then be inherited by its child processes.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Handbrake Ignoring Affinity Settings Before/After Encode

Post by s55 »

@Woodstock, there are no child processes.

It used to work like that back when HandBrakeCLI was used, but since we moved to libhb on the windows ui, it's all within 1 process.
Post Reply