Expectations/guidance on encoding for AppleTV 4K

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
hanumang
Posts: 45
Joined: Thu Feb 04, 2010 6:11 pm

Expectations/guidance on encoding for AppleTV 4K

Post by hanumang »

I'm a long time HB user -- even used it during the MediaFork days :lol: -- and am looking forward to upgrading my ripping hardware & encoding process to 4K eventually. I have a 4K TV already and will be running to the Apple Store to pick up my ATV 4K sometime today.

So, my questions related to encoding for 4K:
  1. My understanding is that HB is built on a 4:2:0 8-bit code base, what are my expectations when it comes to maintaining some semblance of the benefits of 4K? I presume I will lose the benefits of HDR, just based on the 8-bit limitations, but what else will be lost by using HandBrake?
  2. I've noticed that an outside developer has built a 10-bit version of HB, but wasn't sure how useful that might be.
  3. I know that there is not yet a preset for 4K for Apple Devices, so what are the current recommendations? Upsize the 1080p60 preset? Maybe use the Roku 2160 preset as a start?
I am aware that the nightly builds fix compatibility issues with HVC1. (I tried to do a search for 4K and 10-bit on the forums and didn't come up with anything useful with regards to the other questions I have.)

Thanks!
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by mduell »

Yes, any HDR is lost going through HB's pipeline. Yes even with 10 bit input. Yes even with extra libraries for 10 bit encoding.

Upsize the ATV preset and adjust the RF a few points.
WhatZit
Experienced
Posts: 77
Joined: Sat Feb 13, 2016 2:45 am

Re: Expectations/guidance on encoding for AppleTV 4K

Post by WhatZit »

hanumang wrote: Wed Oct 18, 2017 3:19 pmI've noticed that an outside developer has built a 10-bit version of HB, but wasn't sure how useful that might be.
Not useful in the least, because that rubbish is only a custom build with HIGH_BIT_DEPTH set for the relevant contribs.

So, it still uses the libav codebase, piping 8-bit to a 10-bit encoder. Whoop-de-doo!

Honestly, if UHD+HDR is your thing, then HandBrake isn't your thing.

Sure, it can output 2160P 10-bit HEVC using conventional gamma curves, but it cannot handle even the current ST2084 transfer, nor ST2086 HDR static metadata, let alone any of the numerous dynamic standards that will be supported by HDMI 2.1 (i.e. DolbyVision or HDR10+).

Then again, other than scripted frameserving, I can't think of any consumer-grade software (aka free) that does. So, if you're looking for a GUI that can work with HDR, get your wallet out.
hanumang
Posts: 45
Joined: Thu Feb 04, 2010 6:11 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by hanumang »

mduell wrote: Wed Oct 18, 2017 3:54 pm Yes, any HDR is lost going through HB's pipeline. Yes even with 10 bit input. Yes even with extra libraries for 10 bit encoding.

Upsize the ATV preset and adjust the RF a few points.
Thanks mduell. Just so I'm not misunderstanding, that would be adjusting the RF up (as in from 22 to 24) since x265 is more efficient than x264?
hanumang
Posts: 45
Joined: Thu Feb 04, 2010 6:11 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by hanumang »

WhatZit wrote: Thu Oct 19, 2017 1:51 am Honestly, if UHD+HDR is your thing, then HandBrake isn't your thing.

Sure, it can output 2160P 10-bit HEVC using conventional gamma curves, but it cannot handle even the current ST2084 transfer, nor ST2086 HDR static metadata, let alone any of the numerous dynamic standards that will be supported by HDMI 2.1 (i.e. DolbyVision or HDR10+).

Then again, other than scripted frameserving, I can't think of any consumer-grade software (aka free) that does. So, if you're looking for a GUI that can work with HDR, get your wallet out.
Thanks WhatZit.

What do you recommend as a paid encoding application? I am waiting for Apple to update Compressor to support h265 but, in the meantime, I haven't come across anything that seem remotely legit. (as in, I don't want to fork over money for programs like WinXDVD that seem like paid version of HB)
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by mduell »

hanumang wrote: Sat Nov 11, 2017 11:16 pm
mduell wrote: Wed Oct 18, 2017 3:54 pm Yes, any HDR is lost going through HB's pipeline. Yes even with 10 bit input. Yes even with extra libraries for 10 bit encoding.

Upsize the ATV preset and adjust the RF a few points.
Thanks mduell. Just so I'm not misunderstanding, that would be adjusting the RF up (as in from 22 to 24) since x265 is more efficient than x264?
You never said anything about x265. x265's scale is a bit different, but try some reasonable values (i.e. not the extremes of the scale, something in the middle) and see what you like.
WhatZit
Experienced
Posts: 77
Joined: Sat Feb 13, 2016 2:45 am

Re: Expectations/guidance on encoding for AppleTV 4K

Post by WhatZit »

hanumang wrote: Sat Nov 11, 2017 11:19 pmWhat do you recommend as a paid encoding application? I am waiting for Apple to update Compressor to support h265 but, in the meantime, I haven't come across anything that seem remotely legit.
Yes, it's damn strange that Apple would omit full High Sierra/11 support from their own software, but that's the sort of braindead thing that's been going on ever since Jobs' passing. They promise before XMas, though...

Remember, 4K (or UHD) on its own is not the same as HDR, just as 10-bit colour on its own is not the same as HDR. So there'll be plenty of things that will support 4K or 10-bit encoding, but won't have any HDR function.

If it's genuine HDR output that you want, rather than simple 10-bit 4K, then the sort of software I was talking about is Vegas, Premier or DaVinci costing $hundreds. These offer the full 10/12-bit mastering engines and colour grading operations that are required for HDR (even though Premier has the dopiest HDR workflows ever devised).

At the much lower end of the scale, MacX Pro allegedly is capable of using QSV under macOS, which is very interesting if true. I reckon that's questionable (AVC or decode only?), as is whether it processes HDR sources in 10-bits rather than 8-bits (the same limitation as HandBrake).
hanumang
Posts: 45
Joined: Thu Feb 04, 2010 6:11 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by hanumang »

Thanks to some updates in the last few weeks with HB (updating x265 to include 10-bit, in particular), it seems that the preservation of HDR information is now possible.

HB-produced 4K HDR clip for download (~48.6 MB M4V file, per MacOS 10.13). It has only gone thru Subler (1.4.3) to tag the Media Kind as a Movie and alter the track languages to English.

I downloaded a 47 second MP4 clip (~258 MB; a HDR trailer featuring scenes from the film Exodus: Gods and Kings, if it matters.) I chose this file because of length and it, apparently, mimics what ripping a UHD is like -- I honestly haven't come across very many files that are truly HDR, as most of the demo stuff available online purporting to be LG or Samsung or Dolby Vision is not HDR. :shrug:

I put the clip through HB's most recent nightly build:
  • Started with the Apple 1080p60 preset
  • In the Dimensions tab, turned anamorphic off, then adjusted Storage Size width to 3840 (which then adjusts height to maintain aspect ratio)
  • In the Filters tab, I turn everything off (as I almost always work with non-interlaced sources)
  • Under the Video tab,I switch Video Encoder to H.265 10-bit, then alter Frame Rate to Same as source and like to keep it as Constant Framerate.
  • For CRF and preset, I have been experimenting, but the test clip is set at 22 and medium preset
  • In Additional Options, I paste the string

    Code: Select all

    hdr-opt:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,0.0050):max-cll=1000,400
    with adjustments to the max-cll values depending on the source mastering info (This source file doesn't have any max-cll info, that MediaInfo tells me, at least; but I have read about other sources on the web that do.)
  • I have not been touching the other tabs for this test file, if it matters.
I've tested this on my AppleTV 4K connected to a well-adjusted (but not professionally calibrated) 65" Samsung KS8000. [A traditional LCD panel, and Samsung doesn't do Dolby Vision, of course.] My AppleTV (on TvOS 11.0.1) is set to 4K HDR 24Hz. The info bar shows the encoded clip as 4K and HDR.

I welcome feedback/corrections on the procedure and settings.
Last edited by hanumang on Sat Nov 18, 2017 11:25 pm, edited 1 time in total.
User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by s55 »

HandBrake can't produce HDR output, so "faking" it is kind of pointless. It's still been converted through 8bit and screwing with the output as you have has only served to wash out the colours.
hanumang
Posts: 45
Joined: Thu Feb 04, 2010 6:11 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by hanumang »

s55 wrote: Sat Nov 18, 2017 11:24 pm HandBrake can't produce HDR output, so "faking" it is kind of pointless.
Thanks for the reply, s55, but the encoded test clip is seen by my AppleTV as 4K and HDR (as mentioned), where as with other non-HDR 4K sources, these same steps -- including the additional options -- result in a file that is seen as simply 4K.

You suspect there is a bug in the AppleTV that is fooling me?
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by mduell »

hanumang wrote: Sat Nov 18, 2017 11:20 pmThanks to some updates in the last few weeks with HB (updating x265 to include 10-bit, in particular), it seems that the preservation of HDR information is now possible.

HB-produced 4K HDR clip for download
Nope, 100% BS here. HB has an 8 bit pipeline, period. Regardless of your inputs or output selections.
User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Re: Expectations/guidance on encoding for AppleTV 4K

Post by s55 »

It's not a bug in the Apple TV. The file is reporting mis-information to it. It is most defiantly not HDR. To achieve no loss in HDR, HandBrake would require a 10bit pipeline. It only supports 8bit so you are throwing away all the additional colour information before it's even encoded.
Post Reply