Page 1 of 1

[RESOLVED] Metadata changes in a HDR stream

Posted: Sun Oct 21, 2018 4:53 pm
by mparade
I have been decoding my HDR videos using DGDecNV. I have just found one "strange" video having a dgi file that contains two series of different HDR meta data, however both seem to be correct. I have never encountered such an issue so far. All dgi file contained only one serie of HDR metadata with all of my movies. The question now would be, which of the two is the correct one and why dgi file contains multiple different metadata.


Please help.

Re: Metadata changes in a HDR stream

Posted: Sun Oct 21, 2018 4:55 pm
by admin
The stream could have changed and started using different values. Beyond that, it's hard to say. All I do is print out the SEIs that are encountered in the stream. Can you post the DGI file?

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 4:46 am
by mparade
Unfortunately, it is not available anymore. I am going to post the next one of course.
I am using x265 for encoding.Only one "--master-display" and "--max-cll" parameter is accepted by the encoder for the complete stream, so I used the 1st one that was printed out by DGIndexNV. I hope I didn't make a mistake by using the 1st one.

If I find an other "strange" stream using 2 different serie of HDR metadata, I will let you know.
Do you think it has anything to do with the format of the source (HDR10, HDR10+, Dolby Vision)?

Anyway, thank you very much for the support.

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 11:01 am
by admin
It could very well be HDR10+. Where did you get the stream?

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 11:58 am
by mparade
Bought it, then ripped the main feature using makemkv, then used StaxRip with DGDecNV to encode it with x265.
I check it's cover and let you know about the format.

Thank you very much for your time and efforts!

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 12:22 pm
by admin
mparade wrote:
Mon Oct 22, 2018 11:58 am
Bought it
Bought what?

I'm moving this to a separate thread as it is not about colorimetry strictly speaking.

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 12:35 pm
by mparade
I meant the optical disc the stream was located on. Or I do not understand the question, sorry.

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 12:37 pm
by admin
Just asking what disk it is. There are a limited number of known HDR10+ releases, so I am wondering if it is one of them. If you prefer not to say that is OK, too.

Appreciating your contributions to the forum over the years. :salute:

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 1:04 pm
by mparade
It is the Batman Begins (2005) 4K HDR Disc from the version that is available in Central Europe. :)
Anyway, what could one do with HDR10+ and Dolby Vision streams? Is it possible to encode such streams while keeping at least in the output stream the static part of the HDR metadata of them?
I meant if it is possible to encode them to static HDR10 or keep/reach somehow the dynamic metadata of them and pass through those to x265 correctly.

Your help would be greatly appreciated.

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 3:22 pm
by mparade
I have checked. It is HDR10, not HDR10+.
I think the first row is correct. Mediainfo told the same about the source as the dgi file in the first row:

colour_primaries : BT.2020
transfer_characteristics : PQ
matrix_coefficients : BT.2020 non-constant
MasteringDisplay_ColorPrimaries : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
MasteringDisplay_Luminance : min: 0.0050 cd/m2, max: 4000.0000 cd/m2
MaxCLL : 500 cd/m2
MaxFALL : 200 cd/m2

Re: Metadata changes in a HDR stream

Posted: Mon Oct 22, 2018 3:27 pm
by mparade
Isn't it possible for DGIndexNV to export the dynamic metadata from a HDR10+ stream?
Then one could import the resulted json file ("with the meta data that follows samsung's description") into x265 using the -dhdr10-info " path to file" option. :) I would pay for such a new feature.

Re: Metadata changes in a HDR stream

Posted: Tue Oct 23, 2018 9:06 am
by admin
The HDR10 stream should not have different metadata SEIs. I cannot investigate it because you haven't given me anything.

Regarding the export idea, can you link me to the specifications for the Samsung description and something about its JSON representation? Be aware that I have heard the term JSON but I have no idea what it is.

Re: Metadata changes in a HDR stream

Posted: Fri Oct 26, 2018 1:01 pm
by mparade
Hello,

I have just created this file on my HTPC with an older version of DGIndexNV installed. Please let me know if it is not ok to solve the problem. :)

Re: Metadata changes in a HDR stream

Posted: Fri Oct 26, 2018 1:20 pm
by admin
I can't do much with the DGI file. Can you cut the first 100MB, index that, and see if the two MASTERING lines are present. If so, then link to the cut stream.

Re: Metadata changes in a HDR stream

Posted: Tue Dec 25, 2018 3:44 pm
by mparade
Hello there,

I have just got started again my encoding job around my archive collection after a short break... :)
At the moment I do not really know what to do with the 16-bit hdr output of dgdecnv.
I'd either use ConvertBits(10) feature at the end of my script or just feed the 16-bit hdr stream directly into x265 to do a similar job.
Should I use some kind of dithering of it to 10bit (output bitdepth) by using ConvertBits or the internal --dither mode of x265?
Or there is no point of dithering at this stage all? I do not want to lose quality on my mistake.

Any help would be appreciated.

Re: Metadata changes in a HDR stream

Posted: Tue Dec 25, 2018 4:42 pm
by Guest
From the manual
fulldepth: true/false (default: false)

When fulldepth=true and the encoded video is HEVC 10-bit or 12-bit, then DGSource() delivers 16-bit data to Avisynth with the unused lower bits zeroed. The reported pixel format is CS_YUV420P16. If either of the two conditions are not met, then DGSource() delivers 8-bit YV12 or I420 data, as determined by the i420 parameter. When fulldepth=false and the video is HEVC 10-bit or 12-bit, then the video is dithered down to 8-bit for delivery. If you need a reduced color space (less than 16 bits) for your high-bit-depth processing, you can use ConvertBits() as needed after your DGSource() call.
Here is my basic HDR AVS template

Code: Select all

LoadPlugin("C:/Program Files (Portable)/dgdecnv/x64 Binaries/DGDecodeNV.dll")
DGSource("__vid__", fieldop=0, fulldepth=True)
ConvertBits(10)

Re: Metadata changes in a HDR stream

Posted: Tue Dec 25, 2018 6:05 pm
by mparade
Thank you. This means for me that there is no need to add any dithering (default = -1 = do not add dither).

Re: Metadata changes in a HDR stream

Posted: Tue Dec 25, 2018 8:39 pm
by Guest
Correct, dithering will alter the clip slightly, I believe.
The dgi file will also have the correct display numbers.

Re: Metadata changes in a HDR stream

Posted: Tue Dec 25, 2018 10:25 pm
by admin
Is the source HDR? If so, you'll want some DGHDRtoSDR() magic. If not, then ConvertBits(10) is fine.

Re: Metadata changes in a HDR stream

Posted: Wed Dec 26, 2018 3:31 am
by mparade
Thank you. x265's "slower preset speed" increased a lot recently so it is high time again to archive…:)
Yes. The sources are HDR and I want to keep both resolution and color space intact in my encodes altough DGHDRtoSDR must be working like a magic wand. :lol:

Re: Metadata changes in a HDR stream

Posted: Wed Dec 26, 2018 7:47 pm
by Guest
Just in case you need it and it helps in future
DGHDRtoSDR template

Code: Select all

LoadPlugin("C:/Program Files (Portable)/dgdecnv/x64 Binaries/DGDecodeNV.dll")
DGSource("__vid__", fieldop=0, fulldepth=True)
LoadPlugin("C:/Program Files (Portable)/AVS Templates/DGHDRtoSDR/x64/DGHDRtoSDR.dll")
DGHDRtoSDR(impl="255", fulldepth=True, light=300.0, gamma=0.42, hue=0.5, sat=1.0, tm=1.0, roll=0.5)
prefetch(16)
DGPQtoHLG template

Code: Select all

LoadPlugin("C:/Program Files (Portable)/dgdecnv/x64 Binaries/DGDecodeNV.dll")
DGSource("__vid__", fieldop=0, fulldepth=True)
LoadPlugin("C:/Program Files (Portable)/AVS Templates/DGPQtoHLG/x64/DGPQtoHLG.dll")
DGPQtoHLG(impl="255",light=1000)
prefetch(16)