Skip to content

Parse HEVC NAL_UNSPEC62 and create Dolby Vision configuration block mapping

quietvoid requested to merge quietvoid/mkvtoolnix:hevc_st_dovi into main

The goal is to make mkvmerge aware of Dolby Vision RPU type HEVC NAL units.
With that, we can then create Dolby Vision configuration block addition mapping for muxing to Matroska.

So this MR adds parsing for NALU_TYPE_UNSPEC62, but only to retrieve the values from the RPU data header.
This is done according to patent https://patents.google.com/patent/US10701399B2, table A - 1-3

The header is only parsed once, assuming that it is the same for all units in the bitstream.

The DOVIDecoderConfigurationRecord (similar to MP4 box) is then created according to "Dolby Vision Profiles and Levels Version 1.3.3"
However profiles 4 and 9 are missing as they are less common and I haven't compared the RPUs for them.

Ideally, this section would require VUI parameters to be able to identify the EOTF, necessary for a proper dv_bl_signal_compatibility_id value.

And finally, the block addition mapping is created in accordance to the Matroska spec.

For the code, I definitely need to move things around but I'm not sure where.
The DOVIDecoderConfigurationRecord can be for both AVC/HEVC, however I cannot find samples for AVC.
Technically it is generic across codecs, since the same structure is used for MP4/TS as well as MKV.

Finally, the code only seems to work to create the proper block addition mapping.
It is identified correctly with MediaInfo, mkvinfo and a FFmpeg fork with the implementation.

However the files created do not playback as expected on a device with Dolby Vision support, as if the RPU metadata is missing.
I have tried to compare mkvinfo outputs with a MakeMKV mux, and there doesn't seem to be much difference (at least to my eyes).
Maybe there's a better way to dump though.

If you'd like to compare the two files, I can upload them.

Edited by quietvoid

Merge request reports