Automatic per-source HDR/SDR tone-mapping with an HDMI matrix, Home Assistant and Kodi #1552
berezovskyi-oleksandr
started this conversation in
Show and tell
Replies: 1 comment
|
I just wanted to thank you for creating the USB control utility. I had been doing calls over SSH with a script to execute this, and now there's something much better to use! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I wanted HDR tone mapping to be fully deterministic and content-aware: a known, correct state for every source and every title, switched automatically rather than left to runtime detection. Getting there took two small tools I wrote and open-sourced, so I'm sharing both the approach and the code in case it helps anyone running multiple HDR sources.
I have two sources feeding the TV through an EZCOO 4x2 HDMI matrix (mirrored into the grabber): an Ugoos X4 / CoreELEC box and a gaming PC. Tone mapping is driven by two layers
ezcoo-usb-control- a small service that bridges the EZCOO's USB-serial control protocol to Home Assistant over MQTT, so HA can both switch inputs and read the active one.service.video.hdrnotify: on playback start it readsVideoPlayer.HdrTypeand calls HyperHDR'svideomodehdrJSON-RPC directly, so an HDR/Dolby Vision title flips tone mapping on and an SDR one keeps it off, then resets to SDR when playback stops.The two never fight: when a movie starts on the box the matrix input didn't change, so the HA automation has no trigger and never runs - it only set the SDR baseline earlier, for the Kodi menu. The add-on owns the per-title decision from there. End result: SDR menus stay SDR, HDR/DV content lights up correctly, and every transition is driven by an explicit event rather than guessed at.
The two tools, both open-source and probably reusable on their own:
ezcoo-usb-control(EZCOO HDMI matrix -> Home Assistant over MQTT):https://gitea.berezovskyi.dev/oleksandr/ezcoo-usb-control
service.video.hdrnotify(Kodi -> HyperHDR HDR-type bridge):https://gitea.berezovskyi.dev/oleksandr/service.video.hdrnotify
The rest of the rig, written up in full at the links below:
P010_for_V4L2as a DKMS module. Grabber is a Ugreen 25173.Write-ups:
https://blog.berezovskyi.dev/notes/hyperhdr-ambient-lighting/
https://blog.berezovskyi.dev/notes/hyperhdr-host-wyse3040-dietpi/
Thanks to @awawa-dev and everyone on HyperHDR - great project.
All reactions