Multithreading With Multiple Cores

Discuss encoding for devices and presets.
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
regismencer
Posts: 6
Joined: Mon Jan 30, 2012 4:32 am

Multithreading With Multiple Cores

Post by regismencer »

Hello All:

How do I get handbrake to recognize and use all of my CPU cores. I have 2xXeon E5-2660v3's which together give a total of 40 CPU cores with hyperthreading enabled.During a transcode however it only uses roughly 25% of the CPU's capacity. Does anyone know how to bring this up to 100%?

I've tried the :threads=20 and :threads=40 trick but that doesn't seem to make a difference.

Thanks,

Regis
mduell
Veteran User
Posts: 8182
Joined: Sat Apr 21, 2007 8:54 pm

Re: Multithreading With Multiple Cores

Post by mduell »

Forum rules
Activity Log is required for support requests. See Must Read: How To Get Questions Answered on These Forums for details

Forum rules
Activity Log is required for support requests. See Must Read: How To Get Questions Answered on These Forums for details

Forum rules
Activity Log is required for support requests. See Must Read: How To Get Questions Answered on These Forums for details
Woodstock
Veteran User
Posts: 4613
Joined: Tue Aug 27, 2013 6:39 am

Re: Multithreading With Multiple Cores

Post by Woodstock »

And, if you had done a search for "cores", you could have uncovered a lot of discussions (such as this one that just finished, or this one on choosing a new machine for encoding) about how many cores a single encode will use (between 6 and 8, depending upon options), and the only way to use more is to run multiple simultaneous encodes as separate tasks.

Where there are only a handful of things to do, throwing more capacity at the task doesn't do much.
mduell
Veteran User
Posts: 8182
Joined: Sat Apr 21, 2007 8:54 pm

Re: Multithreading With Multiple Cores

Post by mduell »

The 6-8 guidelines are a bit low IMO (or too generic of a suggestion), OP is already getting ~10 and you can easily get more with the right options. But without a log we have no idea what we're dealing with.
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: Multithreading With Multiple Cores

Post by nhyone »

I fed a pair of Xeon E5-2660v3 (2.60 GHz) with a blu-ray disc image through Gigabit Ethernet and got ~70% CPU load for x264 (medium preset, CRF 20). If using x265 (medium preset, CRF 22), I get 40-50% CPU load.

Using HandBrakeCLI 0.10.2 on RHEL 6.7:

Code: Select all

HandBrakeCLI --encoder x264 --encoder-preset medium -q 20 --start-at duration:300 --stop-at duration:300 -a none --input "$inp" --output out.mkv
This appears in the log, so I think this is the upper limit:

Code: Select all

[h264 @ 0x7fd9d80008c0] Application has requested 21 threads. Using a thread count greater than 16 is not recommended.
Other than this, it looks like there is a bottleneck with the decoder or the dispatcher.
mduell
Veteran User
Posts: 8182
Joined: Sat Apr 21, 2007 8:54 pm

Re: Multithreading With Multiple Cores

Post by mduell »

Huh, still no logs.
StressLess
Posts: 1
Joined: Thu Jan 12, 2017 5:54 pm

Re: Multithreading With Multiple Cores

Post by StressLess »

Actually, I ran into the same problem with a dual processor HP Z800 workstation with 24 cores. As it turns out, Windows was the problem! It seems that to be 'green', Windows is configured to 'park' several of the cores, even during high demands! I kid you not! Do a web search for more information if you want to understand this better.

The solution was to edit the registry and tell Windows not park any cores by doing this:

1. Search for 0cc5b647-c1df-4637-891a-dec35c318583
2. Set min and max values to 0
3. reboot
4. PROFIT! :D

BUT, you want to add the 'threads=16' to the Extra Options on the Video tab of Handbrake as using more than 16 threads can actually degrade the quality of the video being encoded. And the x264 encoder will still play nice and you won't see 100% processor being used, but you'll see more of the cores being utilized than before the registry update in ALL apps.

You'll also see your system get a LOT hotter as well since the processors will be more active, which also means if your power supply isn't up to snuff you'll see problems from overloading (though not from Handbrake itself unless, maybe, you increase it's priority).
Post Reply