RPi4 testbuild with HDR support

  • It appears that most if not all of my HDR10 videos get sent to my receiver using 12bit color. I think the builds prior to 2021.12.18 would send them as 8bit, as I detailed above.

    I thought HDR10 used 10bit color. Is that correct? If so, is there a reason LE outputs them as 12bit?

    UHD HDR10 content is encoded as 2160p (aka 4K) 4:2:0 YCbCr 10-bit with Rec 2020 colour gamut and using the h.265 codec typically.

    When HDR support first arrived on the Pi 4B in LibreElec, HDR10 content was replayed with the 10-bits truncated to 8-bit (losing the lowest 2 LSBs), and output in RGB. This meant that the two lowest bits were truncated which would mean a lower quality picture was being delivered.

    (I think some dither noise may have been added to reduce the visibility of the banding this would introduce on 10-bit capable displays - or those that simulate 10-bits with 8bit panels + FRC)

    This truncation was obviously not ideal, but HDMI 2.0 doesn't support 10-bit RGB in 2160p (aka 4K) at all frame rates - so just increasing the bit-depth and staying RGB wasn't really an option (it would mean no 2160p50 or above support).

    For higher frame rate UHD HDR with at least 10-bits, HDMI 2.0a supports either 4:2:0 YCbCr at 10-bit, or 4:2:2 YCbCr at 12-bit. The Pi 4B won't support 4:2:0 (as it requires both horizontal and vertical subsampling/scaling of chroma which the Pi GPU doesn't handle?), but the Pi 4B does support the horizontal-only scaling/subsampling for 4:2:2 YCbCr at 12-bit, which is now being used instead.

    HDMI 2.0a doesn't include any bit depths for 4:2:2 YCbCr other than 12-bit at UHD resolutions, so YCbCr output at UHD is always 12-bit. 10-bit content is just padded with zeroes in the two LSBs to pad the 10-bit content to 12-bit.

    Most of my UHD replay devices (UHD BD player, Apple TV 4K etc.) are set-up for 12-bit 4:2:2 output just as the Pi outputs, as is my AVR. (My Sky Q is 4:2:0 I think - haven't checked recently)

    Edited once, last by noggin (January 8, 2022 at 8:19 AM).

  • Great write up thank you. I was fishing for any possibility of the pi outputting 4k hdr modes my older receiver likes... Looks like I'm outta luck. On the bright side maybe the 2022 crop of receivers won't repeat the 4k/120Hz compatibility fiasco that apparently dominated 2021.

    Edited once, last by onlyrock (January 7, 2022 at 5:30 PM).

  • Hi all - hope this is a good place to ask this:

    Is there any way to know that KODI in libreelec on rpi is playing a HDR video - from the "outside"? By some API call, looking somewhere,...

    I'm using HyperHDR for ambilight, and that needs to be told (switched) when playing a HDR video, so it can properly correct the colors.

    The best I've been able to come up with is using KODI API to get "currentMedia" - and parsing the filename for "HDR". However, I can't be 100% sure all files are (or will be) named correctly.

    So - is there a way to "ask" KODI (or librelecec, or rpi) if it's playing a HDR video? Thanks!

  • Is there any way to know that KODI in libreelec on rpi is playing a HDR video - from the "outside"? By some API call, looking somewhere,...

    Kodi just added support for HDR type info https://github.com/xbmc/xbmc/pull/19983 and it looks like it should be possible to get that via jsonrpc, too.

    The next nightly (which should be built in a few hours) will contain a kodi bump with this feature, it'll also show now a "HDR10" or "HLG" icon in GUI, please give that a try.

    so long,

    Hias

  • is there a way to alter the brightness of subtitles only when watching HDR? in a dark room its almost impossible to have subtitles enabled.

    thanks for any help

    I think this is tied into the lack of support for SDR-in-HDR rendering. Same reason the GUI overlays are very bright when playing HDR content.

    I guess the issue is that with SDR content you might have subtitles set for something like peak-white (level 240 in 8-bit decimal) but in HDR10 PQ this would be massively into the HDR range, close to 1000nits - whereas SDR peak white is just 100nits).

    A stop-gap would be to have two or three different subtitle 'colours' for SDR, HDR10 and HLG content - or a real interim would be to chose a much darker grey for subtitles (though this would make them more difficult to read on SDR content I guess)?

  • is there a way to alter the brightness of subtitles only when watching HDR? in a dark room its almost impossible to have subtitles enabled.

    thanks for any help

    Did you try to change the Opacity parameter in Kodi Settings - Player - Language menu?

  • Kodi just added support for HDR type info https://github.com/xbmc/xbmc/pull/19983 and it looks like it should be possible to get that via jsonrpc, too.

    The next nightly (which should be built in a few hours) will contain a kodi bump with this feature, it'll also show now a "HDR10" or "HLG" icon in GUI, please give that a try.

    I can confirm that the current nightly (20220119) DOES have the feature, and it seems to be working. Icons are shown, jsonapi also reports "hdrtype".

    Also, it seems to have a fix for subtitles on HDR - they seem less-crazy-bright anyway.

  • Hi, I've been playing around with the nightlies, and seem to have hit a configuration brick wall! My 10.0.1 installation works fine, but of course 4K is limited to 8 bit.

    HDMI0 is connected to my 2021 Samsung 4K TV, HDMI1 is connected to my older non-4k capable Bose home theatre system for audio. This setup works fine on the release build.

    When I play back non-4K content everything works as intended. If however I play a 4K file the screen goes blank, the Samsung TV says there is no incoming HDMI video. The audio works fine. If I disconnect HDMI1 and reboot, 4K plays back ok but of course I have no surround audio!

    My guess is 4K video is being routed to HDMI1 for some reason, I can't check because my Bose system won't pass it through anyway.

    I've added hdmi_enable_4kp60=1 to config.txt, and also ran edid create with everything connected and powered up.

    I realise this is a development build and I'm not expecting anybody to waste time on my particular setup issue. I'm just curious to know if anyone has also had this problem and has found a solution.

    Finally, thanks to everyone involved in making LibreElec even better!

    Pete

  • I am also dual-heading my Pi4, 4K TV, HDMI 1.x receiver.

    I've hit issues similar-ish to yours, solved by getting individual EDID files and forcing them at boot. The EDID I'm using for the receiver is one saved while it was plugged in to an old 1080p TV.

    Nico

  • Thanks for that suggestion Nico. I tried getedid delete and then create with a 1080p TV plugged in to HDMI one, but unfortunately the same behaviour occurs. It seems to be unique to the nightlies, including the latest. 10.0.1 works as expected.

  • Thanks for that suggestion Nico. I tried getedid delete and then create with a 1080p TV plugged in to HDMI one, but unfortunately the same behaviour occurs. It seems to be unique to the nightlies, including the latest. 10.0.1 works as expected.

    you have to do some EDID files substitution for the receiver, using the EDID generated when it's plugged to the 1080pTV, then perform part of the getedid script manually to generate the propre cpio file. It's a bit voodoo, but it works for me

  • you have to do some EDID files substitution for the receiver, using the EDID generated when it's plugged to the 1080pTV, then perform part of the getedid script manually to generate the propre cpio file. It's a bit voodoo, but it works for me

    A bit beyond my capabilities alas! I reckon I'll have to stick with the stock release for now and leave the devs to do their thing...

  • Hi HiassofT

    Here are some logs, I hope they might be of some use. First log is my original 10.0.1 instance, which works fine:

    hastebin

    The second log is a clone of that instance, updated to the most recent nightly. HD playback works okay, but playing back a 4K file results in a blank screen:

    hastebin

    I'm going to do a clean install of the latest nightly and see how that works, I'll post a log here once I get it done.

    Thanks

    Pete