How to prevent HDR tracks from being selected when connected to a non-HDR display
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
We have HDR (HLG) streams and when these streams are played on a TV that does not support HDR, and ExoPlayer selects the HDR tracks, the colors look noticeably more washed/grayed than if a "normal" SDR track is played.
We have tested this on an LG TV that supports HLG connected to a Chromecast with Google TV (Android 12) and when disabling HDR (from the settings on the CC) the same HDR tracks are selected by ExoPlayer.
When HDR is enabled on CC display.getHdrCapabilities().getSupportedHdrTypes() contains HDR_TYPE_DOLBY_VISION and HDR_TYPE_HLG, and when disabled it is empty (as expected).
So my question is twofold:
- Why does ExoPlayer select HDR tracks (at least when SDR tracks are also present) when
getSupportedHdrTypes()does not indicate HDR support? Based on the HDR video playback section it's not clear to me if callinggetSupportedHdrTypes()is something the users of ExoPlayer has responsibility of doing, but my initial expecation was that ExoPlayer would handle this for us.
I found this comment which indicates that this will be ExoPlayers responsibility (ExoPlayer does not avoid HDR tracks when connected to a display that does not support them, and this is something that we plan to address soon.), if so is this something we can expect to change in the near future? - How could we disable HDR tracks ourself based on
getSupportedHdrTypes()? Maybe it's possible to compareFormat.colorInfo.colorTransfertoCOLOR_TRANSFER_HLGand disabling the respective tracks, but I'm not sure where I would put that logic (doing it inonTracksChanged()might be a bit weird as it would possibly result in the track being selected and disabled right away and would probably result in losing the benefits of adaptive track selection). Not sure if there are other indications of a track being HDR, looking atHlsPlaylistParserit doesn't seem like theVIDEO-RANGE=HLGtag is parsed and kept
An option we could consider is to tell our backend the state of getSupportedHdrTypes() and only get back streams with SDR tracks if we can't display HDR, but if ExoPlayer could just ignore the tracks that seems like a better solution
Here are two streams to test with:
- HDR and SDR: https://cdn0-47115-odedgestage1.dna.contentdelivery.net/47115-odedgestage1/test/hlg/byliv/byliv_720.smil/cmaf.m3u8?adap=large_h265
- SDR only: https://cdn0-47115-odedgestage1.dna.contentdelivery.net/47115-odedgestage1/test/hlg/byliv/byliv_720.smil/cmaf.m3u8?adap=large
I've taken some pictures of these streams from the demo app to demonstrate the problem (the interesting ones to compare are HDR track with HDR disabled to SDR track, the proper HDR are there for completeness)
Example 1
HDR track with HDR enabled
HDR track with HDR disabled
SDR track
Example 2
HDR track with HDR enabled
HDR track with HDR disabled
SDR track
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.