View Full Version : Subtitle colors (SUP/PGS) with Dolby Vision video
jpsdr
18th March 2024, 12:19
Hello.
Does anyone know what is the color conversion to use to have the expected color of SUP/PGS subtitles displayed with a DV video file ?
It's not a "pure/only" DV, it's an HDR+DV.
Actualy on my subtitles, the green is purple, the yellow is green, etc...:(
Black and white are fine...;)
If there is any formula convertion or anything similar, i'm interested.
jpsdr
24th March 2024, 11:37
So, i've made the following experience.
Created a subtitle with this picture to display:
http://jpsdr.free.fr/XBMC/Palette.png
And the result on a file with DV video is:
http://jpsdr.free.fr/XBMC/Palette_DV.png
I'll try to figure out the DV conversion matrix.
Anyone is free to try also to figure out, i take any input.
von Suppé
24th March 2024, 16:16
Would this only go for Dolby Vision Profile 5? When experiencing green & purple, usually P5 is in play. If so, I reckon it has to do with Dolby proprietary IPTPQc2 colorspace P5 video is encoded in.
Where P8 and P7 aren't.
jpsdr
24th March 2024, 19:10
Video is played properly, it's just the subtitles which are messed up. Video is HDR10 compatible with DV data, so colorspace of video is standard HDR PQ, video is not the green & purple type.
Also, maybe it's a bug in the HW player, and it shouldn't apply DV "things" to color palette subtitles... But it is this way.
Edit:
Something pecular: There is displayed red,green,blue,cyan, magenta, but despite the fact i put all the colors combinations, there is no yellow !
I needed green and yellow colors subtitles, i don't know if it will even be possible... :(
cubicibo
24th March 2024, 22:08
The first time I peek at the x265 subforum to find the right set of parameters to produce encodes for UHD BD, there HAS to be a thread about PGS at the top. Absolutely incredible.
How did you generate the PG stream? Some authoring tools do not seem particularly careful about the transfer matrix and so on.
Furthermore: what is the PID of your subtitle file? It seems that 0x1200-121F are meant for SDR PGS, while 0x12A0-12BF are for HDR. As we lack UHD BD details, it is hard to know why they added additional PIDs for PGS, but it is probably related to this statement found in this technical review (https://ieeexplore.ieee.org/document/7514362):
Subtitles
Subtitles must be carried in a BD-ROM Presentation Graphics (PG) stream. Subtitles use an 8-bit indexed (palletized) format. For SDR BT.709 and SDR BT.2020 videos, a color lookup table (CLUT) is used to convert each pixel in the subtitle image from an 8-bit index value into 8-bit BT.709 YCbCr alpha values. A BT.709 to BT.2020 color space conversion must be applied by the player to convert the BT.709 subtitle pixel values to BT.2020 before compositing with SDR BT.2020 10-bit video. For HDR BT.2020 video, a CLUT is used to convert each pixel in the subtitle from an 8-bit index value into 8-bit BT.2020 ST 2084 YCbCr alpha 8-bit values. The 8-bit pixel values from the CLUT are multiplied by 4 before compositing with 10-bit video pixels.
Either the author has no understanding of the BD subtitle rendering pipeline, or he hints at some behaviour unbeknownst to us peasants. There is no way to specify the matrix in the PG stream, so it has to be handled by the BD player in one way or the other (CLPI data, or different PID). Quite likely, SDR subtitles (HDMV PGS "SDR" 0x1200-1F) are blended before the Dolby Vision layer is added, while the new PID range (HDMV PGS "HDR" 0x12A0-BF) uses a different pipeline where the matrix is expected to be 1:1 to the video, and the 8-bit value are multiplied by 4 to use the full 10-bit range.
This is furthermore backed by:
Mandatory for Players
BT.709 to BT.2020 Conversion for HDMV Subtitles and Graphics
Players must have the capability to convert PG subtitles and IG graphics pixel values from SDR BT.709 YCbCr to SDR BT.2020 YCbCr values before compositing with SDR BT.2020 video
For the technical paper to pinpoint this requirement means this must be in the UHD spec. And that could lead to some bad colour mangling.
jpsdr
25th March 2024, 09:29
This is not a Blu-Ray, this is an MKV file i'm making. I made myself the PGS/SUB. And it's not a BT.2020/BT.709 issue, this is DV specific. The same on a video without DV has the colors displayed properly.
cubicibo
25th March 2024, 09:37
But how do you play back the file? Seems like your issue is either:
- Your software video player applies DV to subtitles. This is very much incorrect and this should be reported to the issue tracker of the player.
- You use a BD player to read the file from a hard-drive. And as it is MKV, the player is unable to know if it should use the SDR or HDR PGS decoder (no PID information in MKV). And eventually it just defaults to SDR "before DV" blend. The fix is simply to use a transport stream container in that case.
jpsdr
25th March 2024, 13:55
I play the file on my HW player, a Zappiti Neo.
And i also think that it shouldn't apply DV to subtitles... But i don't know the specs, and how it's supposed to do.
cubicibo
25th March 2024, 14:29
This is not a Blu-ray Disc player, the manufacturer is not listed on the BDA licensee list: it most likely does not comply with the Blu-ray specifications and overlay the subtitles before the enhancement layer. File a bug report to Zappiti so they can fix their device.
benwaggoner
25th March 2024, 16:58
Would this only go for Dolby Vision Profile 5? When experiencing green & purple, usually P5 is in play. If so, I reckon it has to do with Dolby proprietary IPTPQc2 colorspace P5 video is encoded in.
Where P8 and P7 aren't.
Y'CtCp, yes. Also, Profile 5 also changes the code value to nits mapping shot-by-shot to get as much of the 10-bit range used as possible.
It's all very clever, but means decoding a Profile 5 base layer as normal Y'CbCr PQ 2020 looks really weird. I'm kind of thankful that it is weird enough that no one will think it's operating properly. Makes for easier debugging.
von Suppé
26th March 2024, 10:07
I play the file on my HW player, a Zappiti Neo.
Reading the specs of this player, it runs on a Realtek RTD1619DR chipset. Same as my Zidoo Z9X. Which a couple of years ago also suffered from wrong subtitle colorings. This was brought up in the Zidoo forums, which are monitored by one of the Zidoo people. Consequently, firmware updates then ironed out the issue.
I can imagine your Zappiti having a similar firmware problem. Where letting Zappiti's customer-service folks know about it may trigger a fix?
jpsdr
26th March 2024, 13:42
Probably.
In the meantime, i'll create two subtitles tracks, one with "normal" colors, one with "DV Mode" colors.
I've tried to figure out if there was a linear matrix transform, like this:
[Rdv,Gdv,Bdv]=[Matrix]*[R,G,B].
For now, i've guessed the following, according the display result:
[R,G,B] -> [Rdv,Gdv,Bdv]
[1,0,0] -> [0.5,0.25,0]
[0.5,0,0] -> [0.25,0.125,0]
[0,0,1] -> [0.5,0,0.25]
[0,0,0.5] -> [0.25,0,0.125]
But, after some others guess, it seems that's clearly it's not so simple/linear... :(
So, i'll have to try the other method: test/experiment, what color produces the display i expect.
As it's for subtitles, i don't need true accurate, but something which "looks like". If something looks like green, even if not "pure green", it will be enough.
I can produce basic colors, or at least something which looks like : Red, Green, DarkGreen, Blue, Cyan, Magenta...
And i need (except Black/White) Greend, DarkGreen, Yellow... But... Where is yellow ????
I "only" tried 1 & 0.5 combinations with only 1 or 2 values (like [1,0,0] or [0,0.5,0] or [1,0.5,0]).
Didn't tried yet things like [1,0.5,0.5] or [1,1,0.5]... Maybe i'll be able to discover what produces a yellow display.
It's not so a linear combination, because according display, it seems:
[1,1,0] -> [0,1,0] and [1,0,1] -> [1,0,0]
So... [2,1,1] -> [1,1,0].... ;)
But [1,0.5,0.5] could be worth trying, because it wasn't in my first picture, so, who knows...
quietvoid
26th March 2024, 15:16
Did you try LMS? AFAIK Dolby Vision is transformed and transmitted in that colorspace.
jpsdr
26th March 2024, 18:57
Don't know this, i'll search.
jpsdr
27th March 2024, 15:05
I took a look at LMS, from the few i understood, there is 3 (at least) differents: Equal-energy illuminants, Normalized to D65 and physiological CMFs.
Any idea, by any chance, which one it could be ?
quietvoid
27th March 2024, 17:56
Normalized to D65Probably?
benwaggoner
29th March 2024, 00:00
Probably?
D65 would be my first guess too. D65 is the default color temp for video, and so using it would avoid yet more extra math.
jpsdr
1st April 2024, 16:21
I've made a new experiment, but still not able to figure out what produces true yellow with DV...
Original:
http://jpsdr.free.fr/XBMC/Palette_2.png
Displayed:
http://jpsdr.free.fr/XBMC/Palette_DV_2.png
I stop here, even if i don't have yellow, i have here something which looks like "ocher/ochre" (my dictionary gave me the two words), it will be enough, and i allready have my green and dark green.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.