CE-NG Dolby Vision (+FEL) for DV-licensed SOCs (s905x2, s922x/z, s905x4)

I did the same thing in my testing. Box definitely didn’t like that lol.

I’ve moved around a bit on what I use. I’ve never been keen on running Plex considering all I do is host my content locally within my house.

Historically HTTP have worked best especially since I also run kodi on Android, however unfortunately have issues in either CE 21, or more specifically kodi 21. Hopefully they get addressed shortly. EDIT: Got WebDAV to work. Seems this new caching system is really sensitive to cache size. Had to to set no higher than 512MB (also set adaptive, and 128KB chunk).

SMB, then NFS also but these performed pretty badly on Android. Not surprised as there’s a reason why these two running as clients are normally implemented in Linux as kernel modules vs doing it in a Dalvik application on Android. HTTP (and WebDAV is basically just an extension to HTTP of sorts) is a much simpler protocol hence the performance drop isn’t that significant vs implemented elsewhere.

Either would probably? work better in coreelec due to it being much closer to a traditional Linux install, but I never went back to SMB Or NFS because of the Android limitations I experienced so I haven’t tested this myself yet.

For whatever you’re running. Wasn’t there someone asking about some other Plex addon?

Try this: If you’re running via local USB drive directly in Kodi, set the resolution to 3840x2160 and 59.94hz, set refresh to off (likely set to start/stop). And try that test again with the local media. I suspect you will experience the same distorted colors. Ime, There’s something about a refresh rate switch that handles some setting it seems in the playback logic that somehow doesn’t occur without it (my guess is perhaps the set dispautomode method doesn’t get called or not enough times).

The below is from playback of a P5 DV file:

cat /sys/devices/virtual/amhdmitx/amhdmitx0/config

cur_VIC: 352
cur_video_param->VIC=352
VIC: 352 3840x2160p50hz
Colour depth: 12-bit
Colourspace: RGB
Colour range: full
EOTF: DV-Std
YCC colour range: limited
Colourimetry: BT.2020nc
PLL clock: 0xdb1004b9, Vid clock div 0x000a66cc
audio config: on
audio on/off: on
audio source: SPDIF
audio type: Dobly Digital+
audio channel num: 2 channels
audio sample rate: 192kHz
audio sample size: 16bit
3D config: off

When I playback DV on my LG G2, it seems the bit is also set incorrectly to 12-bit.

Why don’t I get wonky colors then? Why is it only some people with the incorrect 12-bit setting will see weird colors, but others wont?

I found some more DV videos higher than 24p. Their original formats (some were mp4, ts, even mov) And even ran it through mkvtoolnix to generate mkv. Everything plays fine on my Sony X85J, in 8-bit RGB tv-led .

In fact, unless I’m mistaken I think 12-bit RGB @ 50hz actually exceeds the HDMI 2.0b bandwidth, since 60hz 8-bit RGB DV would hit the max 600ish mhz bandwidth.

I couldn’t find a 50hz sample, though. They were all 60gz. Are you able to share it?

The source content I was playing is actually 24p (Shogun in P5 DV). I’m not sure why the LG reports 50hz through that query.

Would think it is down to the TV in question - don’t think the actual content being sent would be different just the mode is being set “wrong”

For example My E8 also showed fine when set to 8 or 12 bit - it very likely ignores the bit depth when it knows it’s DV-STD.

On the flip side my E8 does though do something with the colorimetry bt.2020/bt.709 flag in DV-STD whilst other TV ignore that, it really also should be ignoring that.

Bottom line DV-STD is “hi-jacking” the HDMI to get its IPT 12bit data across to the TV, the TV should not really be concerned with the other hdmi connection values like bit depth and colour as they are not relevant in that case, but as this is more a bolt-on on top of hdmi there maybe loop holes where those details are having an impact - that would be fine when those detail align to the content and would not be noticed, but in the wrong case they are exposing those issues and odd things start to happen.

That makes sense re: why the TV seems apathetic to the incorrect bit selection. I’ve been doing a bit more digging into this issue and chatting with the PM4K creator.

Just a quick high-level summary.

There are 2x apps that extend Plex onto Kodi. They are PM4K (PlexMod4Kodi) and PKC (PlexKodiConnect).

Both are capable of SMB path substitution to directly play the content. However by default, both utilize the webstream method where it passes the stream URL generated by Plex into the internal player.

What’s interesting is that Kodi sets the correct bitrate when handling PKC’s webstream vs PM4K’s webstream. We would expect both to have incorrect bits if webstream was the issue.

Going through logs though, I noticed that PKC invokes Kodi to use a slightly different method of handling that webstream on the same content (GUI @ 2160p / 60Hz; content is 23.98Hz):

PKC
info <general>: PLEX.playback_decision: The playurl for DirectPlay is: https://192-168-50-60.3519aa45431e49a1946399da99cd65ef.plex.direct:32400/library/parts/464/1694634547/?Accept=%2A%2F%2A&Content-Type=application%2Fx-www-form-urlencoded&Accept-Language=hu&X-Plex-Device=Linux&X-Plex-Model=4.9.269&X-Plex-Device-Name=Kodi+CoreELEC&X-Plex-Platform=Generic&X-Plex-Platform-Version=1.0.0&X-Plex-Product=PlexKodiConnect&X-Plex-Version=3.9.0&X-Plex-Client-Identifier=a8f8926f-a26f-4a74-a2ef-a7adc30e7492&X-Plex-Provides=client%2Ccontroller%2Cplayer%2Cpubsub-player&X-Plex-Protocol=1.0&Cache-Control=no-cache&X-Plex-Token=XXXXXXXXXXXXXXXXXX
2024-04-02 11:32:25.919 T:3952     info <general>: PLEX.api: Found external subs: []
2024-04-02 11:32:25.926 T:4527  warning <general>: Setting most video properties through ListItem.setInfo() is deprecated and might be removed in future Kodi versions. Please use the respective setter in InfoTagVideo.
2024-04-02 11:32:25.927 T:4527  warning <general>: ListItem.addStreamInfo() is deprecated and might be removed in future Kodi versions. Please use InfoTagVideo.addVideoStream(), InfoTagVideo.addAudioStream() and InfoTagVideo.addSubtitleStream().
2024-04-02 11:32:25.931 T:4527     info <general>: Skipped 2 duplicate messages..
2024-04-02 11:32:25.931 T:4527     info <general>: PLEX.MOVIES: PKC add-on for movies stopped
2024-04-02 11:32:25.959 T:3777     info <general>: Skipped 1 duplicate messages..
  info <general>: VideoPlayer::OpenFile: plugin://plugin.video.plexkodiconnect.movies/?mode=play&plex_id=475&plex_type=movie&filename=Anna.mkv

vs

PM4K
2024-04-02 11:27:52.731 T:3777     info <general>: VideoPlayer::OpenFile: https://192-168-50-60.3519aa45431e49a1946399da99cd65ef.plex.direct:32400/library/parts/464/1694634547/?X-Plex-Token=XXXXXXXXXXX&X-Plex-Client-Profile-Name=Generic&X-Plex-Client-Identifier=13efcf13-722b-464f-a491-93652706d317

The only difference is Kodi uses the plugin handler for PKC’s webstream. The URL is then resolved after. PM4K directly passes through the webstream URL to the OpenFile function. This seems like a Kodi bug because the outcome of the two shouldn’t differ.

The generated URL has some differences as well. These are plex parameters which shouldn’t impact the results, but I will test on a custom build that matches up the parameters to PKC. That will eliminate a variable.

I am wondering if: force_mode_switch_by_dv

maybe the root cause - or another similar check for res etc. which is ultimately causing a call to: drmModeSetCrtc

possibly that is causing a HPD event or something else which will trigger the set_display_mode_auto on the amlogic side.

If so possibly can front run with a call to hdmitx_set_vsif_pkt

Not in a position for a week or so to try this out myself - any thoughts?

I verified on a custom PM4K build today that even if the generated Plex URL is identical to that PKC, the bitrate is still set incorrectly within CE.

This is to be expected since the Plex URL is merely showing Plex-specific parameters such as version, server OS, etc. It should make no difference to the color bit determination as the core video stream is still identical.

What you stated in the previous post is a bit over my head, but I hope another CE team member can take a look to see if there is a straightforward fix to reconcile webstream handling between the plugin handler and directly passing the URL through.

Is there somewhere I can get FEL DV test videos to determine definitely that everything is set up right? Like something that will show an image or something if the full FEL layer is being played correctly, but not if it’s not working?

The most common FEL Test video is BL_EL.mkv, that you can download here

When base and enhanced layers both play indicating proper FEL playback, you’ll see the silhouette of the woman and camera over the pinwheel colors.

When proper FEL playback is working, it will be obvious.

These links appear valid still.
https://forum.kodi.tv/showthread.php?tid=371521

play the BL_EL.mkv

If fel triggers you will see the faint outline of the universal pictures logo, MRC logo and woman looking through binoculars. More specifically its the opening scene of Mortal Engines.

This test video is more obvious to test if FEL works.

edit: Lots of others to play with here

1 Like

Thanks everyone! These are great, and now I know its working right! In the time after I’d posted I’d found what must have been some other versions of those videos (maybe earlier versions?), and was a bit concerned because they barely played at all (lots of artifacting and my TV kept cutting out and saying no signal, etc.). But these played perfectly and its obvious FEL playback is working!

1 Like

will this driver dovi.ko be updated in the future?

I tried Gemini man 4k remux with dual video track dolby vision, and it just played as hdr10. is it normal or i do it wrong? I use jellyfin addon mode but it played other video with single video track dolby vision well.

Yes, DTDL is not supported, yet. It’s easy to convert them to single track though, look for dovi scripts.

I used makemkv to convert it and it played as dv finally. but it not played perfectly smooth, sometimes laggy with sound track hint keep popping up, not always the same position. you pause and play it may backon smooth but laggy after.
is 4k60 dv is too much or something wrong with the soundtrack?

Gemini Man plays perfect for me in MKV, I don’t think the issue is 4k60.

It is. Good to know, had not yet tested the only two movies I have in 4K/60. This and the other Ang Lee UHD ‘Billy Lynn’s Long Halftime Walk’.

General
Unique ID                                : 183698475997609864186322798479036966635 (0x8A330A2102D8943CD59957B0E8B0E6EB)
Complete name                            : Y:\Movies4K\Gemini Man (2019).4K.HDR.DV.ATMOS\Gemini Man (2019).4K.HDR.DV.ATMOS.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 71.9 GiB
Duration                                 : 1 h 57 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 87.9 Mb/s
Frame rate                               : 59.940 FPS
Movie name                               : Gemini Man (2019)
Encoded date                             : 2022-01-22 16:27:30 UTC
Writing application                      : mkvmerge v64.0.0 ('Willows') 64-bit
Writing library                          : libebml v1.4.2 + libmatroska v1.6.4

Video
ID                                       : 1
ID in the original source medium         : 4113 (0x1011)
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@High
HDR format                               : Dolby Vision, Version 1.0, Profile 7.6, dvhe.07.09, BL+EL+RPU, no metadata compression, Blu-ray compatible / SMPTE ST 2086, Version HDR10, HDR10 compatible
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 1 h 57 min
Bit rate                                 : 83.7 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.168
Stream size                              : 68.4 GiB (95%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0010 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 5180 cd/m2
Maximum Frame-Average Light Level        : 1577 cd/m2
Original source medium                   : Blu-ray

Audio
ID                                       : 2
ID in the original source medium         : 4352 (0x1100)
Format                                   : MLP FBA 16-ch
Format/Info                              : Meridian Lossless Packing FBA with 16-channel presentation
Commercial name                          : Dolby TrueHD with Dolby Atmos
Codec ID                                 : A_TRUEHD
Duration                                 : 1 h 57 min
Bit rate mode                            : Variable
Bit rate                                 : 4 204 kb/s
Maximum bit rate                         : 7 944 kb/s
Channel(s)                               : 8 channels
Channel layout                           : L R C LFE Ls Rs Lb Rb
Sampling rate                            : 48.0 kHz
Frame rate                               : 1 200.000 FPS (40 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossless
Stream size                              : 3.44 GiB (5%)
Title                                    : Dolby ATMOS
Language                                 : English
Default                                  : Yes
Forced                                   : No
Original source medium                   : Blu-ray
Number of dynamic objects                : 11
Bed channel count                        : 1 channel
Bed channel configuration                : LFE
mixlevel                                 : 80 dB
ltrtcmixlev                              : 3.0 dB
ltrtsurmixlev                            : 3.0 dB
lorocmixlev                              : 3.0 dB
lorosurmixlev                            : 3.0 dB

Menu
00:00:00.000                             : en:Chapter 01
00:07:21.491                             : en:Chapter 02
00:15:31.680                             : en:Chapter 03
00:18:12.841                             : en:Chapter 04
00:24:39.177                             : en:Chapter 05
00:30:59.407                             : en:Chapter 06
00:34:09.430                             : en:Chapter 07
00:42:39.940                             : en:Chapter 08
00:50:25.338                             : en:Chapter 09
00:56:45.819                             : en:Chapter 10
01:03:30.006                             : en:Chapter 11
01:08:12.822                             : en:Chapter 12
01:16:45.901                             : en:Chapter 13
01:24:44.412                             : en:Chapter 14
01:30:04.549                             : en:Chapter 15
01:34:00.851                             : en:Chapter 16
01:42:14.461                             : en:Chapter 17
01:47:07.287                             : en:Chapter 18