hardware h264 encoding

Archive of historical feature requests.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
JRuss16
Posts: 2
Joined: Sat Jul 26, 2014 9:50 am

hardware h264 encoding

Post by JRuss16 »

both AMD 7000 series and up and Nvidia GeForce 600 series and up have hardware h264 (mp4) encoders i do not know how hard it is to use them or if you can

but if you can use them for the h264 encoding i think it would greatly improve speed (at least it would cut back system lode)
Smithcraft
Veteran User
Posts: 2697
Joined: Thu Jan 22, 2009 8:04 pm

Re: hardware h264 encoding

Post by Smithcraft »

I take it you are referring to OpenCL and Cuda?

SC
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: hardware h264 encoding

Post by s55 »

They achieve speed by sacrificing quality and filesize. You can already do this with x264 if you change settings. If quality and filesize are not important to you, select a faster encoder preset on the video tab.

As it stands, Intel QuickSync is the only general purpose hardware solution worth using. While it doesn't match up to x264 it's quite usable for many scenarios.
AMD's is more targeted to low-latency applications like Video Conferencing and screen capture so it's not really suitable for use in HandBrake.
Nvidia's solution is more general purpose but the results are not good enough to justify including it.


@Smithcraft -> He's reffering to AMD VCE and Nvidia NVENC I believe. Both are dedicated ASIC hardware like quicksync I believe. Rather than the older CUDA/Proprietary GPU solutions
Smithcraft
Veteran User
Posts: 2697
Joined: Thu Jan 22, 2009 8:04 pm

Re: hardware h264 encoding

Post by Smithcraft »

Ok, I'm kinda out of the loop.

SC
clarke85
Posts: 5
Joined: Thu Jul 31, 2014 7:25 pm

Re: hardware h264 encoding

Post by clarke85 »

About amd open cl acceleration,are you talking about AMD® Accelerated Parallel Processing

http://developer.amd.com/tools-and-sdks ... g-app-sdk/

or are you talking about another feature?
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: hardware h264 encoding

Post by s55 »

While VCE is accessible via OpenCL, it's another SDK as far as I know. Doesn't really matter really from a users point of view.

Either way, not an awful lot of use to HandBrake. We already have OpenCL support and it utilises 40% GPU for a 5% performance improvement under optimal conditions. Add x264 OpenCL support and you can end up with 100% GPU Usage for a very small gain on top of that.
clarke85
Posts: 5
Joined: Thu Jul 31, 2014 7:25 pm

Re: hardware h264 encoding

Post by clarke85 »

I noticed the 5% boost in performance only in downscaling from 1080p to 720p with the bicubic scaler, and i read the wiki and the milestone, but they don't tell that the opencl support work in standard transcoding like for example Cyberlink Mediaespresso...

1)Am i wrong?
2)Handbrake uses libav?
3)In future is possible to see an acceptable gaining of performance?

Thanks ^^
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: hardware h264 encoding

Post by s55 »

OpenCL is not good for h264 encoding which is why we now have ASIC hardware like quicksync, nvenc and VCE. So I would not expect much in the way of gains in OpenCl code path in the future.

And yes, if your not scaling, there is no benefit. Downscaling go to 720p is as near as optimal as you'll get for the opencl bicubic scaler.

x264 which has opencl lookahead too. You can enable it with the extra options on the video tab. opencl=1
Don't expect much speed up though. I find mostly it's slower than raw CPU.

Speed quality filesize. Pick 2. That's the trade off you have to make.
clarke85
Posts: 5
Joined: Thu Jul 31, 2014 7:25 pm

Re: hardware h264 encoding

Post by clarke85 »

s55 wrote: x264 which has opencl lookahead too. You can enable it with the extra options on the video tab. opencl=1
Don't expect much speed up though. I find mostly it's slower than raw CPU.

Speed quality filesize. Pick 2. That's the trade off you have to make.
Thanks for the reply :wink:

s55 wrote: Speed quality filesize. Pick 2. That's the trade off you have to make.
For me was impossible to understand this statement until i googled and i found this XD.
Monday, Nov 23, 2009

"Creation comes out of imperfection."

There's an old proverb in the video encoding world: "Speed, size, quality: pick two." It means that you always have to make a trade-off between the time it takes to encode a video, the amount of compression used, and the picture quality. Well, this release of HandBrake refuses to compromise. It picks all three.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: hardware h264 encoding

Post by s55 »

The statement was a bit of tongue in cheek as x264 was still undergoing some pretty big improvements during that time.
The reality is, the statement still holds true today.

You use fast x264 settings and you'll compromise quality or filesize to achieve that speed. You choose slow x264 settings and you can achieve better quality and / or compression
JRuss16
Posts: 2
Joined: Sat Jul 26, 2014 9:50 am

Re: hardware h264 encoding

Post by JRuss16 »

clarke85 wrote:About amd open cl acceleration,are you talking about AMD® Accelerated Parallel Processing

http://developer.amd.com/tools-and-sdks ... g-app-sdk/

or are you talking about another feature?
i am talking about AMD VCE and Nvidia NVENC
Boildown
Posts: 9
Joined: Tue Sep 10, 2013 5:52 pm

Re: hardware h264 encoding

Post by Boildown »

The Open Broadcaster System / project has NVEnc encoding up and running, and a contributer has an alpha of the VCE encoder available. Also, Quicksync is fully up and running as well. If you use OBS's Video Source plugin and save to disk, you could transcode a file from whatever it was to one of these.

That said, the quality per bitrate of NVEnc and VCE is pretty much on par with x264's SuperFast preset. I.e., not very good. As they are hardware implementations of H.264, there's really no chance of it improving, except as newer chipsets of video cards come out over the years. Similar to how Quicksync's quality per bitrate improved from Sandy Bridge to Ivy Bridge to Haswell, NVEnc's quality per bitrate improved between Kepler and Maxwell (currently Maxwell is only seen in the GTX 750 and GTX 750Ti, by the way).

But its still not good enough to actually use to encode your videos over what you can get now with x264. You're better off just using Handbrake with preset speedy enough for your needs. I can't imagine the Handbrake devs would have any interest in implementing either NVEnc or VCE, as they don't really fit any need a Handbrake user is going to have.
ramitbhalla
Enlightened
Posts: 103
Joined: Sat Jan 18, 2014 12:12 am

Re: hardware h264 encoding

Post by ramitbhalla »

What are the chances that Handbrake will use NVEnc to implement hardware encoding for NVidia based systems (like Intel QuickSync)?
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: hardware h264 encoding

Post by mduell »

Chances? Sure.

Just waiting for you to submit a patch and commitment to ongoing support.
ramitbhalla
Enlightened
Posts: 103
Joined: Sat Jan 18, 2014 12:12 am

Re: hardware h264 encoding

Post by ramitbhalla »

Be happy to help, just need to figure out how to get started. One thing definitely I can help with testing, I test handbarke with over 500 configurations about once a month using the nightly build.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: hardware h264 encoding

Post by s55 »

While NVEnc and VCE are not of interest, or really suitable at all for HandBrake in their current form, I'd be interested to hear more about your test setup.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: hardware h264 encoding

Post by mduell »

ramitbhalla wrote:Be happy to help, just need to figure out how to get started. One thing definitely I can help with testing, I test handbarke with over 500 configurations about once a month using the nightly build.
The source repo and compiling instructions are available at https://trac.handbrake.fr/wiki/CompileGuide
ramitbhalla
Enlightened
Posts: 103
Joined: Sat Jan 18, 2014 12:12 am

Re: hardware h264 encoding

Post by ramitbhalla »

We have a repository of "troublesome" files which have caused issues in the past with handbrake, every month or so we download the latest nightly build and run it against this repository in different configurations and report it back here if we find any bugs.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: hardware h264 encoding

Post by s55 »

Just to extend further on NVENC and VCE now that I'm on a desktop.

VCE is geared towards low-latency applications, video conferencing and capture applications. It's not actually all that fast, and it's not a particularly good for general purpose encoding.
NVEnc currently seems to be geared up for similar usage scenarios, but seems to do a better job than AMD. The problem with this, is the SDK isn't GPL compatible so it can't be included in HB. I see OBS has an implementation, but I'm pretty sure they have a license issue there.

Either way, Quality on both isn't so hot, so really not worth it.

Intel has been making pretty large leaps with their encoder. More so than Nvidia / AMD to date. If it wasn't for that, I'd have rejected the patch outright a long time ago. As it stands, at higher quality settings, it's actually usable. Although, if you have a faster quad/hex/octo core CPU, the benefits are not so profound as x264 can surpass it in speed.
Boildown
Posts: 9
Joined: Tue Sep 10, 2013 5:52 pm

Re: hardware h264 encoding

Post by Boildown »

s55 wrote:NVEnc currently seems to be geared up for similar usage scenarios, but seems to do a better job than AMD. The problem with this, is the SDK isn't GPL compatible so it can't be included in HB. I see OBS has an implementation, but I'm pretty sure they have a license issue there.

Either way, Quality on both isn't so hot, so really not worth it.

Intel has been making pretty large leaps with their encoder. More so than Nvidia / AMD to date. If it wasn't for that, I'd have rejected the patch outright a long time ago. As it stands, at higher quality settings, it's actually usable. Although, if you have a faster quad/hex/octo core CPU, the benefits are not so profound as x264 can surpass it in speed.
NVEnc has been available a lot less time than Quicksync and for fewer generations, Nvidia may well produce something more competitive to Quicksync in the generation after Maxwell.

There now exists two-pass presets in NVEnc that are pretty untested (because OBS is pretty much the only thing other than Shadowplay to use NVenc, and OBS is for live encoding, 2 pass not applicable); they might be better than Super Fast for pre-recorded content.

More info: http://developer.download.nvidia.com/co ... ppNote.pdf

If you want to find a dev that knows a lot about NVEnc, look up OBS's Btbn. Maybe he'll be willing to take on an additional project, or know someone who is.
Post Reply