Kodi Community Forum

Full Version: Kodi Android build with support for Dolby Vision MKV
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Was there an update in the last 2 weeks? I was able to watch ZS: justice league a few days after it came out with no problem.  I tried watching the rest of the movie today and its studdering and the only colors I can see is grey, purple and green.
(2021-04-01, 07:55)Vinniet85 Wrote: [ -> ]Was there an update in the last 2 weeks? I was able to watch ZS: justice league a few days after it came out with no problem.  I tried watching the rest of the movie today and its studdering and the only colors I can see is grey, purple and green.

Nope.

And if you install this build the only way to update it is installing another apk with the same package name as this one.

This build has a different package name so you can have main official kodi and this build installed side by side.

Few days ago I got black screen when playing Dolby Vision.
Changed cables, hooked directly to the tv, nothing.

Powered the tv off and on and it was back.

Even netflix wouldn't work.

So, as you can there's a handshake problem somewhere, might be the LG tv, might be the shield.
When trying to reboot the shield, first try to turn the tv off and on again.
It might solve your problem.
(2021-04-01, 17:02)fandangos Wrote: [ -> ]
(2021-04-01, 07:55)Vinniet85 Wrote: [ -> ]Was there an update in the last 2 weeks? I was able to watch ZS: justice league a few days after it came out with no problem.  I tried watching the rest of the movie today and its studdering and the only colors I can see is grey, purple and green.

Nope.

And if you install this build the only way to update it is installing another apk with the same package name as this one.

This build has a different package name so you can have main official kodi and this build installed side by side.

Few days ago I got black screen when playing Dolby Vision.
Changed cables, hooked directly to the tv, nothing.

Powered the tv off and on and it was back.

Even netflix wouldn't work.

So, as you can there's a handshake problem somewhere, might be the LG tv, might be the shield.
When trying to reboot the shield, first try to turn the tv off and on again.
It might solve your problem.

Thanks for the reply!

I used a hdr10 version and played it using all of the same equipment and same version of kodi last night and it worked. Tried the dv version and I still had the same stuttering and color issue with the dv version. Maybe my tv got an update but couldn't find any info on firmware release dates.
(2021-04-01, 17:42)Vinniet85 Wrote: [ -> ]
(2021-04-01, 17:02)fandangos Wrote: [ -> ]
(2021-04-01, 07:55)Vinniet85 Wrote: [ -> ]Was there an update in the last 2 weeks? I was able to watch ZS: justice league a few days after it came out with no problem.  I tried watching the rest of the movie today and its studdering and the only colors I can see is grey, purple and green.

Nope.

And if you install this build the only way to update it is installing another apk with the same package name as this one.

This build has a different package name so you can have main official kodi and this build installed side by side.

Few days ago I got black screen when playing Dolby Vision.
Changed cables, hooked directly to the tv, nothing.

Powered the tv off and on and it was back.

Even netflix wouldn't work.

So, as you can there's a handshake problem somewhere, might be the LG tv, might be the shield.
When trying to reboot the shield, first try to turn the tv off and on again.
It might solve your problem.

Thanks for the reply!

I used a hdr10 version and played it using all of the same equipment and same version of kodi last night and it worked. Tried the dv version and I still had the same stuttering and color issue with the dv version. Maybe my tv got an update but couldn't find any info on firmware release dates.
Are you sure about which Kodi app you are running? There may be two of them installed as this one will not overwrite the original.
Yes, I uninstalled my kodi, and used the 32bit version on pg1 of this thread. Although it was my first time sideloading, I placed the apk onto a thumb drive and plugged the thumb drive into my shield. Used fx explorer pro to locate the file and installed it after allowing for unknown sources to be installed. Hopefully I did that correctly as this is my first time trying.
Installed 64 bit version on my SHIELD 2019 and I'm getting constant buffering on a 15gb file, I can play hdr10 version fine and even 4k hdr remuxes but the dolby vision version just stops and starts every 30 seconds.
(2021-04-02, 00:55)Babazoolay Wrote: [ -> ]Installed 64 bit version on my SHIELD 2019 and I'm getting constant buffering on a 15gb file, I can play hdr10 version fine and even 4k hdr remuxes but the dolby vision version just stops and starts every 30 seconds.
The bit rate of the file could be much higher than the others. If you are serving them on a network then you might have bandwidth issues.
(2021-04-02, 00:27)Vinniet85 Wrote: [ -> ]Yes, I uninstalled my kodi, and used the 32bit version on pg1 of this thread. Although it was my first time sideloading, I placed the apk onto a thumb drive and plugged the thumb drive into my shield. Used fx explorer pro to locate the file and installed it after allowing for unknown sources to be installed. Hopefully I did that correctly as this is my first time trying.
Sounds right. Might want to reload. Not sure why you chose the 32 bit version.
(2021-04-02, 02:12)JimVR4 Wrote: [ -> ]
(2021-04-02, 00:55)Babazoolay Wrote: [ -> ]Installed 64 bit version on my SHIELD 2019 and I'm getting constant buffering on a 15gb file, I can play hdr10 version fine and even 4k hdr remuxes but the dolby vision version just stops and starts every 30 seconds.
The bit rate of the file could be much higher than the others. If you are serving them on a network then you might have bandwidth issues.

The bit rate of the file is almost identical. So is the file size. But the dolby vision version is the only one that buffers.
I tried this with Kodi installed directly on Sony XH95/X950H and while it triggers one of the TV's Dolby Vision picture modes every time (tested with various mkv files which are dv profile 7 and 8), I don't think it works correctly.

I can see from Kodi log that OMX.dolby.vision.dvhe.stn.decoder is selected for every file while the kodi playback info shows amc-dvh1(s) (not sure how that's related to the OMX codec identifier).

This is the log output when opening a video file:
Code:
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.aac.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPAC3
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPADPCMIMA
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.amrnb.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.amrwb.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.APE
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPDTS
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPDTSEXPRESS
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPDTSHD
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPEAC3
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.flac.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.g711.alaw.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPLPCMALAW
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.g711.mlaw.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPLPCMMLAW
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPMP1
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPMP2
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.mp3.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.opus.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.raw.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.vorbis.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPWMA
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.AUDIO.DECODER.DSPWMAPRO
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.VIDEO.DECODER.HEIC
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.MTK.VIDEO.DECODER.AVC
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.google.h264.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec::Open Testing codec:OMX.dolby.vision.dvhe.stn.decoder
INFO <general>: CDVDVideoCodecAndroidMediaCodec:: Open Android MediaCodec OMX.dolby.vision.dvhe.stn.decoder

According to Dolby Vision profiles and levels pdf (Annex III), dvhe.stn is profile 5.

I'm wondering how the codec selection works, because Codec Info app as well as kodi log list several decoders available:
Code:
Mediacodec decoder: OMX.dolby.vision.dvhe.stn.decoder
Mediacodec decoder: OMX.dolby.vision.dvhe.dtr.decoder
Mediacodec decoder: OMX.dolby.vision.dvhe.st.decoder
Mediacodec decoder: OMX.dolby.vision.dvav.se.decoder

That means the TV should be able to decode profiles 4, 5, 8 and 9 and I would expect the correct decoder to be selected for any of those profiles.
As for profile 7, playback should probably fall back to HDR10 without triggering DV picture mode.

Can anybody shed some light on the current behavior? Thanks.
(2021-04-02, 17:35)nohajc Wrote: [ -> ]Can anybody shed some light on the current behavior? Thanks.
OK, I've looked at the source and there's a particular piece of code which queries supported codec profiles and compares them to the input's profile:
https://github.com/fandangos/Kodi-HDR-Ed...c.cpp#L672

Problem is, the profile is never set for DV. For some other codecs, it is set according to m_hints.profile but unfortunately, that already contains HEVC profile.
In any case, DV profile information is already used in CDVDDemuxFFmpeg::AddStream() (if (dovi->dv_profile > 7) ... in DVDDemuxFFmpeg.cpp) so if the profile number was somehow propagated, it could be used in CDVDVideoCodecAndroidMediaCodec::Open() to rule out the wrong dv decoders too.

Codec profiles returned by codec_caps.profileLevels() should be the DV profiles defined here:
https://developer.android.com/reference/...ileDvheDtr

So, it's just a matter of mapping them to the correct profile number. If I manage to build Kodi, I could try experimenting with this.
About P7 Fel DV.

I was talking with a friend that has a better understanding of Dolby Vision than I have and he allowed me to paste his reply to my question:


Its not a mkv structure problem. For this to work properly the SoC needs two HEVC decoders, which neither the Realtek nor the Nvidia Shield have. But even then, the licensed and implemented Dolby SDK needs to support profile 7 as well. That last part is very unlikely to happen in anything other than a UHD BD player.
So BL + RPU is the best thing that we can hope for imo.

So, P7 FEL enhancement layer is kinda impossible for anything that's not a uhd bd player.
(2021-04-03, 15:26)fandangos Wrote: [ -> ]So, P7 FEL enhancement layer is kinda impossible for anything that's not a uhd bd player.
Thanks, this makes sense. I'm not that concerned with the lack of proper profile 7 support. AFAIK, there's an "unofficial" approach where you can sort of convert P7 FEL to P7 MEL or even P8 without EL. This essentially drops the "enhancement" data completely which achieves better playback compatibility.

Anyway, my TV apparently supports several single-layer (BL+RPU) profiles and I am mainly interested in getting profile 8 to work. As I have said, there is one decoder for each profile but Kodi always picks the first decoder available which supports "video/dolby-vision" MIME type regardless of supported profiles. So in my case, it picks the profile 5 decoder for any DV mkv I throw at it. Playback seems to work but I doubt it processes the metadata correctly because of the profile mismatch. Maybe it only plays the HDR10 base layer.

I already verified I can play P8 in the default Android player if I remux to mp4 container. Now, I have a debug build of Kodi HDR edition and I'll try to patch it. Can I submit a pull request when I have a working solution? I would have used github issue tracker but there isn't one. Smile
(2021-04-03, 15:57)nohajc Wrote: [ -> ]Thanks, this makes sense. I'm not that concerned with the lack of proper profile 7 support. AFAIK, there's an "unofficial" approach where you can sort of convert P7 FEL to P7 MEL or even P8 without EL. This essentially drops the "enhancement" data completely which achieves better playback compatibility.

Anyway, my TV apparently supports several single-layer (BL+RPU) profiles and I am mainly interested in getting profile 8 to work. As I have said, there is one decoder for each profile but Kodi always picks the first decoder available which supports "video/dolby-vision" MIME type regardless of supported profiles. So in my case, it picks the profile 5 decoder for any DV mkv I throw at it. Playback seems to work but I doubt it processes the metadata correctly because of the profile mismatch. Maybe it only plays the HDR10 base layer.

I already verified I can play P8 in the default Android player if I remux to mp4 container. Now, I have a debug build of Kodi HDR edition and I'll try to patch it. Can I submit a pull request when I have a working solution? I would have used github issue tracker but there isn't one. Smile
You can submit PRs to https://github.com/fandangos/Kodi-HDR-Edition

As for the profiles, I had tried sending the correct profile string, level to MediaCodec and it made no difference.
If you want to be sure the metadata is used properly, you need to test with a sample where Dolby Vision makes a noticeable difference. For example, the Spears & Munsil UHD HDR Benchmark disc.
(2021-04-03, 18:46)quietvoid Wrote: [ -> ]If you want to be sure the metadata is used properly, you need to test with a sample where Dolby Vision makes a noticeable difference. For example, the Spears & Munsil UHD HDR Benchmark disc.

Thanks for the tip. I've already done more tests and it looks like Sony's Dolby Vision indicator might be more reliable than I first thought. It will kick in for profile 8 and even profile 7 MEL but apparently not for FEL. That seems consistent with the TV's declared capabilities. MEL is essentially just a dummy layer if I understand it correctly, so that might explain why profile 8 decoder does not reject it.

While I tested all of this after patching Kodi to explicitly select proper codec according to DV profile, I suspect I didn't need the patch at all. That's because Android actually allows codec aliases which share the same underlying implementation.  Problem is, you cannot tell whether a codec is really distinct or not unless you have Android 10 (API level 29 adds getCanonicalName and isAlias methods: https://developer.android.com/reference/...icalName())

Bottom line is, if we can assume there's always just one HW codec and we throw everything at it, playback should work nicely with the added bonus that the codec might decode even profiles which it doesn't officially support (like profile 7 with MEL) and it should hopefully revert to HDR10 if there's any actual incompatibility. On the other hand, if the profiles are strictly checked before we attempt to play a file, we handle the case of distinct HW codecs correctly but profile 7 will be always rejected (and because original mime type was overwritten and every dv decoder rejected, Kodi tries ffmpeg's SW decoder next Big Grin).