Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hardware decoding function #5004

Closed
sun6560032 opened this issue Mar 10, 2023 · 14 comments
Closed

Add hardware decoding function #5004

sun6560032 opened this issue Mar 10, 2023 · 14 comments

Comments

@sun6560032
Copy link

Description of the feature or enhancement you'd like to see in HandBrake

Add hardware decoding function.Similar software :shanaencoder, FFQueue, StaxRip, xmediarecode, and Hybrid can be set to hardware decoding to reduce CPU load.

What Operating System are you running?

windows11

What version of HandBrake are you running?

1.6.1

Where did you download HandBrake from?

github

Activity Log, Crash Log or any other details

No response

@sr55
Copy link
Contributor

sr55 commented Mar 10, 2023

HandBrake already supports hardware decoding. As long as it's enabled in preferences, it'll automatically use it for encodes where it makes sense and not when it doesn't.

Even with hardware decode and encode, you can still get 100% CPU as other functions will still be run on the CPU. Audio, Sync, Filters etc. This is normal.

@Uloque
Copy link

Uloque commented Mar 11, 2023

Well, @sr55 this might be a misunderstanding.

On most platforms Handbrake offers hardware encoding only, it does not offer any option in its preferences to enable hardware decoding afaik.

The (english) docs say:

"(...) HandBrake supports the AMD VCN hardware encoder but does NOT support the hardware decoder.(...)"

"(...) HandBrake supports the NVIDIA NVENC encoder but does not support the NVDEC decoder. (...)"

... same on the ARM Media Foundation

However, HandBrake supports both QSV encode and decode if the video source in a format which is supported by the QSV hardware (that would be x264) and if run on the Apple Platform only.

The above is not documented this clearly in the non-english docs afaik.

Consequently, this issue here boils down to:

Please consider enabling hardware decoding in Handbrake for platforms other than Apple with Intel QuickSync only. For instance, the PC Platform with VCN or NVENC

@sr55
Copy link
Contributor

sr55 commented Mar 11, 2023

On PC, Both QuickSync Decode and NVdec are support.

The docs are probably in need of an update. Will look into it.

However, HandBrake supports both QSV encode and decode if the video source in a format which is supported by the QSV hardware (that would be x264) and if run on the Apple Platform only.

Native QuickSync support is not available on Apple. On Apple Devices, we use the VideoToolbox API which will utilise the underlying hardware support.

QSV Decode works on Windows along side QSV Encoder. You can even use the QSV decoder with other encoders although the benefit to doing so is very limited. Typically I'd recommend keeping to software decoding when not using QSV.

@sun6560032
Copy link
Author

sun6560032 commented Mar 11, 2023

HandBrake已经支持硬件解码。只要它在首选项中启用,它就会自动将其用于有意义的编码,而不是在没有意义时。

即使使用硬件解码和编码,您仍然可以获得 100% CPU,因为其他功能仍将在 CPU 上运行。音频、同步、过滤器等这是正常的。

That's right. When the software I mentioned selects hardware decoding, it can call hardware decoding normally. However, HandBrake will not call hardware decoding even if it is opened in the preferences. Windows 11, nvidia graphics card.
intel graphics card and AMD graphics card do not know whether it is the same. You can experiment by yourself.

@sr55
Copy link
Contributor

sr55 commented Mar 11, 2023

That's right. When the software I mentioned selects hardware decoding, it can call hardware decoding normally. However, HandBrake will not call hardware decoding even if it is opened in the preferences. Windows 11, nvidia graphics card.
intel graphics card and AMD graphics card do not know whether it is the same. You can experiment by yourself.

Please post a log but this is likley by design. We deliberately turn it off automatically when it's not suitable to use it. For example, when software filters are applied. These cannot be run on the GPU.

@Uloque
Copy link

Uloque commented Mar 11, 2023

@sun6560032

"(...)HandBrake will not call hardware decoding even if it is opened in the preferences(...)"
May I ask for a screenshot? I have never seen such a setting's choice in Hb's preferences.
All I know of is the encoding settings.

@sr55
Copy link
Contributor

sr55 commented Mar 11, 2023

You won't see it if it's not available for use. On Windows, Tools Menu -> Preferences -> Video. If it's avaiable, it'll show up under the relevant encoder choices.

No preferences on Linux/Mac

@sun6560032
Copy link
Author

I think I know a little. Other software calls the Windows DirectX API Dxva2 for hard solution, so the compatibility is very good. It is possible that HandBrake is cross-platform, without special optimization for Windows, and there are too many hard solution restrictions on the calling interface.

@sr55
Copy link
Contributor

sr55 commented Mar 12, 2023

DXVA2 support was dropped from HandBrake many years ago as it was simply too unreliable. It's not a path we would go down again.

@sun6560032
Copy link
Author

DXVA2支持在很多年前就从HandBrake中删除了,因为它太不可靠了。这不是我们会再次走下去的道路。

That's a great pity. HandBrake now has too many hardware decoding restrictions, so it is much less efficient than similar software when using hardware coding, especially when the source video is high resolution, such as 4K.

@ChabaneAmaury

This comment was marked as off-topic.

@sr55

This comment was marked as off-topic.

@HandBrake HandBrake deleted a comment from ChabaneAmaury Mar 22, 2023
@sr55 sr55 closed this as completed Mar 27, 2023
@78Alpha
Copy link

78Alpha commented Apr 10, 2023

I find it strange that this is closed, as use of hardware decoding is still non-functional by anyone. There is little documentation, and no matter how many filters you strip, something like NVDEC won't work. I'd like to see a debug option where you can force NVDEC or a hardware encoder on and will grey out all options that don't work with it.

Hardware decoding is also useful for removing bottlenecks. Instead of the CPU being pegged at 100% for decoding, it can worry about filtering and audio. If the decoder worked, I would use multiple instances of handbreak for NVDEC and NVENC as with a driver patch, I can now hit 20+ streams each like an enterprise card. While currently, since no NVDEC, it leaves the NVENC only hitting 50% utilization.

@galad87
Copy link
Contributor

galad87 commented Apr 11, 2023

See #4731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants