Handbrake conversion failed with hardware encoder, retrying with default software encoder

Hello. I have a problem that is similar to others, but I’m having trouble understanding my specific situation and how to apply any information from the previous threads.

I have a relatively new Windows 10 machine (6 months old) with a pretty good CPU (Intel® Core™ i7-7700 CPU @ 3.60GHz) and 16gb Memory
I have two display adapters with latest drivers. Primary is an NVIDIA (with hardware encoding) and an unused Intel with Quick Sync and Hardware encoding.
Details from the logs are below (and the log itself) for machine and cards.

A typical 30 minute HD program encodes in 22 minutes with the “MP4 Normal” profile on a quiet machine.
5 hours of Superbowl coverage encodes in about 3 hours under the same circumstances, with nearly 100% CPU for a good part of the time

I have started to believe that things are not working optimally on my system. I know it’s apples to oranges, but if I optimize the same files on Plex to the highest possible resolution for IOS …
these conversions happen in 50% of the time of MCEbuddy.

I freely admit that I don’t know what I am doing, I have seen the following error in most of my logs:
Handbrake conversion failed with hardware encoder, retrying with default software encoder

I am wondering if anyone can help me understand whether things are working correctly with the encoding process.
Any assistance is definitely appreciated…

Regards,
BrianGGG

Here is a sample logfile:

xxxTwo.and.a.Half.Men.S06E24.Baseball.Was.Better.With.Steroids - Copy.ts-Profile Test-2018-02-06T07-47-08.6189349-05-00.log (815.5 KB)

Here are a few key items from the log:

2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] CPU: Intel® Core™ i7-7700 CPU @ 3.60GHz
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - Intel microarchitecture Kaby Lake
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - logical processor count: 8
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] Intel Quick Sync Video support: yes
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - Intel Media SDK hardware: API 1.25 (minimum: 1.3)
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - H.264 encoder: yes
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - preferred implementation: hardware (any)
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - capabilities (hardware): breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - H.265 encoder: yes (8bit: yes, 10bit: yes)
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - preferred implementation: hardware (any)
2018-02-06T07:51:32 MCEBuddy.AppWrapper.Handbrake --> [07:51:32] - capabilities (hardware): bpyramid vsinfo opt1

2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> CUDA Device Query (Runtime API) version (CUDART static linking)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Detected 1 CUDA Capable device(s)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Device 0: “GeForce GTX 1050”
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> CUDA Driver Version / Runtime Version 9.1 / 7.5
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Detected CUDA Driver version = 9.1
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> CUDA Capability Major/Minor version number: 6.1
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Detected CUDA Hardware version = 6.1
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Total amount of global memory: 2048 MBytes (2147483648 bytes)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> MapSMtoCores for SM 6.1 is undefined. Default to use 128 Cores/SM
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> MapSMtoCores for SM 6.1 is undefined. Default to use 128 Cores/SM
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> ( 5) Multiprocessors, (128) CUDA Cores/MP: 640 CUDA Cores
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> GPU Max Clock rate: 1455 MHz (1.46 GHz)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Memory Clock rate: 3504 Mhz
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Memory Bus Width: 128-bit
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> L2 Cache Size: 1048576 bytes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Total amount of constant memory: 65536 bytes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Total amount of shared memory per block: 49152 bytes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Total number of registers available per block: 65536
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Warp size: 32
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Maximum number of threads per multiprocessor: 2048
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Maximum number of threads per block: 1024
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Maximum memory pitch: 2147483647 bytes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Texture alignment: 512 bytes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Concurrent copy and kernel execution: Yes with 2 copy engine(s)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Run time limit on kernels: Yes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Integrated GPU sharing Host Memory: No
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Support host page-locked memory mapping: Yes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Alignment requirement for Surfaces: Yes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Device has ECC support: Disabled
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> CUDA Device Driver Mode (TCC or WDDM): WDDM (Windows Display Driver Model)
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Device supports Unified Addressing (UVA): Yes
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Compute Mode:
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 7.5, NumDevs = 1, Device0 = GeForce GTX 1050
2018-02-06T07:51:36 MCEBuddy.AppWrapper.NVidiaQuery --> Result = PASS
–> Process exited with code 0
–> NVidia H.264 Hardware Encoder Detected : True
–> NVidia H.265 Hardware Encoder Detected : True

You might try altering the profile so that ffmpeg is first. When I was working with my profiles during the .8 beta, I couldn’t get handbrake to do HW acceleration in any meaningful capacity. FWIW, I’ve got the same CPU and RAM and am using a NVidia GTX 1060 - I’m getting H265 (HEVC) encodes of about 20 minutes for an hour of HD programming.

To change the order of the encoding engines, go into the config folder and pull up profiles.config. Look for this line in the MP4 Normal profile:
order=handbrake,ffmpeg,mencoder

Change it so ffmepg is first.

Good luck! Will.

1 Like

You have a really interesting setup, you have both CUDA (NVidia) and QuickSync (Intel) hardware acceleration. However it looks like your intel drivers are buggy and causing handbrake to hang when it tries to use hardware acceleration.

2018-02-06T07:51:46 MCEBuddy.AppWrapper.Handbrake → [07:51:46] qsv_enc_init: using ‘hardware (2)’ implementation, API: 1.25
2018-02-06T07:51:47 MCEBuddy.AppWrapper.Handbrake → Error code -17, hb_qsv_wait_on_sync 602
2018-02-06T07:51:47 MCEBuddy.AppWrapper.Handbrake → ERROR: encqsv: MFXVideoENCODE_EncodeFrameAsync failed (-17)

So MCEBuddy switches back to software encoding using handbrake without trying to use the nvidia hardware acceleration via ffmpeg (we’ll add that optimization in future to try different hardware encoder before switch to software, primarily because it’s very uncommon to have systems with both types of hardware vendors in them).

The solution as @Will_Tschumy pointed out is to change the order in your profile to ffmpeg and that should make it use the NVidia card first for hardware encoding and if that are no issues with the driver it should be significantly faster.

On a side note it’s possible that your Intel card isn’t properly initialized and that your Nvidia card is your primary monitor/display card which is probably why handbrake can’t get it to initialize. If you want to Intel hardware encoding instead of Nvidia then you may want to try the fake display trick to activate your intel card.

Will,

Thanks very much for this reply. This was definitely a helpful suggestion.
A few things:

I moved HandBrake down in the order like you said, but in a test run HB was still chosen despite being third out of three on the list.

However, when I completely removed HB from the priority list, this led to the use of FFMPG. This was a good success as from there I could see in Task Manager that my GPU was being used for decoding. CPU usage is way down now as well as the encoding no longer dominates my machine.

My only question at this point: Is this the most I can do here? I got to a 12 minute conversion rate for 30 minutes of HD, which is similar to Will’s 20 minute benchmark above, but this was not HEVC (only H264). So I still think something is not optimal.

Also, my GPU is hardly breathing, is this an indication that there is opportunity for multi-threading?

Here’s what the new Log file looks like now with FFMPEG as the encoder (with a bunch of MENCODER crop nonsense removed for size reasons):

xxxTwo.and.a.Half.Men.S06E24.Baseball.Was.Better.With.Steroids - Copy.ts-Profile Test-2018-02-06T13-05-04.4043705-05-00.log (982.2 KB)

thanks,
Brian

Thanks Goose for this reply. It came in while I posted my (just) previous reply.

I tried to do the fake display trick, but as I saw from the internet this is easier said than done in Windows 10. The directions do not account for the latest operating system, and I found it impossible to get the second monitor online. FYI: The Intel card came as the default with my Dell machine, but I bought the upgraded NVIDIA. Dell delivered the machine with both cards, even thought I only have one monitor hooked up to the NVIDIA.

Since I’m not seeing blazing speed with the NVIDIA hardware acceleration, is it worthwhile to pursue Quick Sync with the theory that this will be much faster?

thanks,
BRianGGG

Your logs show a conversion rate of about 180fps. That’s not bad, maybe @Will_Tschumy can share what he sees with his setup.

Intel performance depends heavily on the driver and hardware. It can be anywhere from 70 to 600fps. One thing you can try is changing your bios settings to make the intel your primary and give it a try. We will patch up that option to honor the user selected encoder order if both encoders have hardware acceleration features available in the next build. By default select the encoder with hardware options available (unless the profile otherwise states) (handbrake being the first choice)

The FFMpeg conversion logs show 12.1x (363 fps) average conversion rate. It seems like there are so many nuances to the QuickSync stuff, that I chose not to use it at all, even though my machine supports it. During conversion, however, the CPU doesn’t spike at all - all the encoding is done on the GPU. The CPU runs about 50% during show analysis.

Hope this helps. Thanks! Will.

1 Like

Thanks Will.

I was about to ask how the same CPU configuration could have such different results until I ran into the below CUDA benchmark. Your 1060 card is nearly twice as fast as my 1050…

https://browser.geekbench.com/cuda-benchmarks

Next, I’m going to plug my monitor into the Intel card to see if I can get FFMPEG to run using this rather than NVIDIA. I’ll pick the fastest one to use.

I looked at the BIOS, and there aren’t too many options in it … I can’t even figure out how to make Intel primary.

BrianGGG

1 Like

Keep in mind if you’re trying to use Intel’s QuickSync you need to use handbrake and for Nvidia CUDA you need to use ffmpeg in the profile. That’s the only supported combination currently.

Where does one find the “config” folder you speak of?

in the program folder - for me it’s:
C:\Program Files\MCEBuddy2x\config