High Sierra w/ Kaby Lake Processor HEVC Hardware Support

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
Alucard
Posts: 3
Joined: Tue Oct 03, 2017 4:34 pm

High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by Alucard »

I have a 2017 iMAC "High Sierra" with the i7 Kaby Lake processor, 40GB of RAM, and 1TB SSD drive.

When encoding with handbrake to X265 it throttles the CPU for 6-7 hrs for a normal length Blu Ray Movie. It doesn't appear to be taking advantage of hardware acceleration in the CPU for Kaby Lake? Is that true or does it just take that long to encode in X265 even with hardware acceleration? If it's not using hardware acceleration, any chance we'll get it in the future? I've been trying the nightly builds already and not noticing any difference in encode times.

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

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by s55 »

x265 is a software implementation of H.265 AKA HEVC, so no, it's not hardware accelerated.

Unfortunately, if you want hardware acceleration, you really want to consider using WIndows. Apple's VideoToolbox API that allows for hardware acceleration on Mac doesn't expose the full functionality of the hardware encoders so there isn't much in the way of choice for OSX as there isn't direct access to the hardware like we have on Windows and to an extent Linux.

H.265 encoding is a complex process, so yes it will take a long time. If you post an activity log we can maybe suggest tweaks that would use faster settings at the expense of quality/size. There are trade offs that can be made sometimes that won't make a lot of difference to the end result but can make the encode a bit faster.
Alucard
Posts: 3
Joined: Tue Oct 03, 2017 4:34 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by Alucard »

Thanks for the response. Not what I was hoping for but what I kind of expected. Any idea if running a Windows 10 VM on the above hardware would allow access to hardware acceleration?
Alucard
Posts: 3
Joined: Tue Oct 03, 2017 4:34 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by Alucard »

Another option might be to use Boot Camp on the MAC to boot the computer into Windows 10?
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by s55 »

Bootcamp in theory could work, assuming the drivers are not problematic. VM's will not.
MickM
Novice
Posts: 68
Joined: Sat Nov 04, 2017 3:45 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by MickM »

Did anybody ever end up trying bootcamp to see if this approach worked? I'm only just getting started with what to do about my near-full NAS box and converting all of the previously ripped DVDs on it to H265. Haven't even run handbrake once yet...
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by s55 »

I did try it under bootcamp the other week only to find Apple has disabled the hardware so it simply won't work.
MickM
Novice
Posts: 68
Joined: Sat Nov 04, 2017 3:45 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by MickM »

Thanks for the info. I've been spending the past few hours converting a DVD movie I ripped (via MDRP on the Mac) into H265. The source is Beauty and the Beast, 2 hours 9 minutes long with a file size of 6.85GB. My first attempt was with the default Fast 1080p30 setting - the resultant file size was 642.7MB and I did notice a quality hit. Then I started reading the manual and figured that because my source material was a DVD (a 720 wide thing) that it pointless using a 1080 setting, so now I'm trying HQ 720p30 Surround. It's still doing the conversion and taking just a little longer than real time to do it on my mid-2015 MacBook Pro 2.5GHz Core i7 with 16GB RAM. I have thousands of ripped DVDs to process - I worked out all this is going to take nearly 1 year of 24/7 processing to convert everything. Sigh...
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by rollin_eng »

I would suggest trying x264, you will probably get larger files but encoding time should be faster.

The 1080 in the preset is just the maximum, if your source is less that's ok.
MickM
Novice
Posts: 68
Joined: Sat Nov 04, 2017 3:45 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by MickM »

Yes - it's a trade off. I also suspect the H265 codec is still being tweaked/optimized and hasn't fully stabilized yet.
I hear the new upcoming version of Final Cut Pro (coming this month?) will output to H265 and you can bet Apple will probably use hardware acceleration for that (while not making that capability available to shmucks like us).
This thread hasn't made any quantitative mention of hardware acceleration improvements. I know the Mac is out for now, but on a PC what kind of improvement factor might be expected for conversion time using hardware acceleration?
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by Woodstock »

When dealing with DVD video, you need to make sure you are removing the interlacing and telecining "properly". Otherwise, what would be a good encode will look absolutely horrid if anything moves.

"Fast 1080p30" has telecine turned off, and decomb as the default method for removing interlacing. Pick a part of the movie that has some movement, and experiment with those settings to see what looks best. Then you can change to x265 for the final encode of the whole film.
MickM
Novice
Posts: 68
Joined: Sat Nov 04, 2017 3:45 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by MickM »

So I know what interlacing is, and I just looked up telecining - it appears to be a video recording vs playback frame rate alignment issue (I'm an electronics engineer so to me that translates to a sample rate conversion issue). You'd think telecining would already be dealt with in the production of the region 1 DVD itself given that it's tailor made to play on an NTSC TV. I can also see interlacing being something detectable (or maybe defined in meta-data) and therefore automatically correctable within Handbrake (yes/no?).

Anyway, at this point I have hijacked the thread and it's no longer addressing the original poster's question. I should maybe start another thread entitled something like "How come Handbrake doesn't have a setting for region 1 DVDs?" (where all I need to worry about is the chosen algorithm and quality/encode_time). However, I'm guessing that will degenerate into an RTFM thing (which I haven't done). Like I said, I'm a newbie and was hoping all this would be easier (or at least inherently consistent), but I don't know what I don't know...
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by mduell »

MickM wrote: Sat Nov 04, 2017 6:47 pmI also suspect the H265 codec is still being tweaked/optimized and hasn't fully stabilized yet.
HEVC/H.265 was standardized in 2013 and the relevant parts to HB haven't changed since.
MickM
Novice
Posts: 68
Joined: Sat Nov 04, 2017 3:45 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by MickM »

I was actually referring to the H.265 encoder. I can easily imagine the decoding being completely finalized but tweaking/optimization of the encoder being an on-going thing. Whatever - I'll take your word for it :-).
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by Woodstock »

A disks region code has very little to do with how the video is recorded. And if the original was shot at 24 frames per second on film, whatever encoding is on the disk won't be "native". This is why it can be very important to experiment with the settings for a particular source.

Unless, of course, you're like me, and only look at the "hash" of a "deinterlace gone bad" when you're so bored with the story that you start looking for things to complain about... :)
MickM
Novice
Posts: 68
Joined: Sat Nov 04, 2017 3:45 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by MickM »

I agree that a DVD's region code could have very little to do with how the video was recorded. But when making that video available on DVD for a different region code, surely the original's recorded frame rate must be appropriately interpolated/extrapolated (or otherwise monkeyed with) to the target region's frame rate before making the master for that DVD. I would have thought that for my entire library of ripped region 1 DVDs (including content that originated in e.g. PAL countries and later made available in the US) that I wouldn't ever have to touch the frame rate setting in Handbrake. This is really turning out to be much messier than I figured.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by JohnAStebbins »

On many DVDs, telecine is flagged in metadata (soft telecine). That allows the original progressive frames to be reconstructed without special image processing and detection logic. The progressive frames are reconstructed by combining appropriate fields. In order to align to the original 24fps framerate of the film, these progressive frame alternate in duration between 2 fields and 3 fields. So at this point, you have slightly stuttery progressive frames. Since HandBrake knows what the nominal framerate of the soruce is (i.e. 24fps), we smooth the stutter and produce evenly spaced frames.

But that's not the end of the story. DVD is a [Censored] of a format in many ways. It's very common for cut scenes to break the 3/2 cadence of the telecine flags. So you end up with a few stray fields that can't be reconstituted into progressive frames. I.e. you have *variable framerate* video because you have a mix of 24fps reconstructed progressive frames and 30fps interlaced frames. This is why HandBrake's framerate default in all presets is "same as source" *variable* or "peak framerate" *variable*. "same as source" outputs every frame with the exact same duration as each input frame. "peak framerate" does the same thing, but drops frames if the framerate exceeds a certain maximum.

If you have any old SciFi TV shows that were originally shot in a mixture of film, CGI, and video, these can be an awful mess. They don't bother to convert things to one consistent frame type.

And then there is hard telecine, which isn't flagged in metadata. Image analysis is required to detect the 3/2 pattern of the interlacing. This is what HandBrake's detelecine filter is for.

So, the point of all this is I agree with you. You shouldn't have to touch the frame rate setting. You should leave it set to HandBrake's default variable rate setting. The only case where you shouldn't do this is when you have a broken player that does not properly play variable framerate video. If you have such a broken player, unfortunately you have no choice but to select the best constant framerate setting for the particular DVD you are encoding. HandBrake has a "Same as source" constant framerate option, but it fails to produce smooth output with certain cases of mixed framerate DVDs. There's no way for HandBrake to know in advance what it's going to see as far as framerate goes.
MickM
Novice
Posts: 68
Joined: Sat Nov 04, 2017 3:45 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by MickM »

Wow - that was a great explanation! Very much appreciated.
lederermc
New User
Posts: 1
Joined: Sun Sep 23, 2018 5:09 pm

Re: High Sierra w/ Kaby Lake Processor HEVC Hardware Support

Post by lederermc »

videotoolbox really only allows specifying bit rate - not CRF. So if you have an idea of the bitrate that gives you the quality you want then videotoolbox can be useful and significantly quicker than software encoding. To use videotoolbox with ffmpeg specify -c:v hevc_videotoolbox and a bitrate: -b:v 2500k or higher if you like... you will also need to specify a video tag if you want Quicktime Player to recognize the file as playable: -tag:v hvc1 . What I did is encode a minute of video (no audio: -an) about 5 minutes from the start (to avoid opening credits) using software and -crf 22. I then check out the bitrate then encode the full file with that video bitrate. After doing that to a couple of time I can see what bitrate give me the quality I like. Yes it's a pain in the asterisk but once you figure out a nice video bitrate, ffmpeg with videotoolbox is a big time saver over handbrake.
Post Reply