Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UHD BD Dolby Vision dual layer streams #17186

Merged
merged 1 commit into from
Feb 2, 2020
Merged

Conversation

fandangos
Copy link
Contributor

Description

When playing any container (mkv, mp4...) that has a Dolby Vision idependent layer stream will show up as 1080p HEVC/AVC stream resulting in a solid green screen.
This is not a big problem when playing idependent files like mkv/mp4 because you are able to select the video stream. This is a big problem when playing UHD BD in Disc Navigation mode that changing the video streams during the menus cause the menu to end and the movie to start.
This also results in menus that are not readable or watchable because of the solid green screen on top.

Exclusive to UHD BD, Dolby made a second layer called the enhancement layer.
This layer is merged by the player during playback and uses proprietary Dolby software to do so.
Discarding this layer has no effect on Apple TV, or Nvidia Shield of Xbox One S/X because
those can only play Dolby Vision single layer tracks that is embended into the first video stream.

Dolby Vision documentation:
https://www.dolby.com/us/en/technologies/dolby-vision/dolby-vision-white-paper.pdf

Motivation and Context

The if statement might seem unspecific and could cause wrong streams to be removed by mistake.
This is NOT the case here.

The streamID 0x1015 is exclusive to the Dolby Vision enhancement layer that Kodi cannot play in any way or form.
The only possible scenario as it would by mistaken by another track is if the video container had 5 video tracks, since those are made in sequence 0x1011 being the first.
Audio starts at 0x1100 and subtitles at 0x12A0.

FFMpeg uses the following method to check for DV streams:
FFmpeg/FFmpeg@6ebe88f

Identification using the codec_tag as identified by ffmpeg is not possible for two reasons:

  1. If detected it would remove the first track (unless we made a code similar to the one that checks for Dolby True HD audio track and removes duplicated audio tracks).
  2. On UHD BD those streams have the exact same codec_tag as you can see on this sample from a debug log which was added a CLog output to check codec_tag of both streams:
    https://pastebin.com/spCfL2FQ

Those tracks are also mistaken by MediaInfo as can be seen here:
https://pastebin.com/Zv2fndLF

How Has This Been Tested?

This has been tested in a Windows x64 enviroment with DVDs, Blurays and UHD BDs.
This has been tested with 3 titles that have Dolby Vision enhancement layer: 2001 Space Odyssey, The Shining and The Hereditary.

This causes no harm to dolby vision playback on Nvidia Shield or Apple TV because the first layer, which is the only layer that those players can identify and play is embended into the first video stream, so removing the second one causes no harm.

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@FernetMenta
Copy link
Contributor

The streamID 0x1015 is exclusive to the Dolby Vision enhancement layer that Kodi cannot play in any way or form.

wrong. id can be any pid of a broadcasting service, i.e. a tv channel

@fandangos
Copy link
Contributor Author

The streamID 0x1015 is exclusive to the Dolby Vision enhancement layer that Kodi cannot play in any way or form.

wrong. id can be any pid of a broadcasting service, i.e. a tv channel

Had no idea about live tv.
If it does, this can be moved here:
https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp#L1727

This would only be triggered for bluray/uhd-bluray content.

Exclusive to UHD BD, Dolby has a second video layer that is mistaken by a 1080p HEVC/AVC stream causing a green screen when played.
@fandangos fandangos reopened this Jan 13, 2020
@fandangos
Copy link
Contributor Author

@FernetMenta better?
And sorry for my mistaken closing it.

@FernetMenta
Copy link
Contributor

better?

yes

@Paxxi
Copy link
Member

Paxxi commented Jan 18, 2020

@FernetMenta is this good enough to merge?

@Paxxi Paxxi added Component: Video Type: Improvement non-breaking change which improves existing functionality v19 Matrix labels Feb 2, 2020
@Paxxi Paxxi added this to the Matrix 19.0-alpha 1 milestone Feb 2, 2020
@Paxxi
Copy link
Member

Paxxi commented Feb 2, 2020

I think this got Fernets approval so merging it for now, can always fix if I misunderstood.

@Paxxi Paxxi merged commit 4e63657 into xbmc:master Feb 2, 2020
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Feb 3, 2020
Fix UHD BD Dolby Vision dual layer streams
@Paxxi Paxxi mentioned this pull request Feb 8, 2020
13 tasks
Maven85 pushed a commit to Maven85/kodi that referenced this pull request May 5, 2020
Fix UHD BD Dolby Vision dual layer streams
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 4, 2020
Fix UHD BD Dolby Vision dual layer streams
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 5, 2020
Fix UHD BD Dolby Vision dual layer streams
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 6, 2020
Fix UHD BD Dolby Vision dual layer streams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Video Type: Improvement non-breaking change which improves existing functionality v19 Matrix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants