You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VideoToolbox can natively decode HEVC Profile 5 Dolby Vision and pass on the proper RPU/metadata but it needs special handling with MKV files. I haven't had the time to look into your VideoDecoder implementation (or how the Media Extensions API works) but from experience you basically need to reconstruct the extradata when missing and properly pass on the dvcC blob.
There's no good documentation since it's proprietary. I just studied libdovi code and inspected what AVAssetReader does with MP4 files. Basic implementation looks like this:
funcmakeDVCC(fromdoviConfig:Data)->Data?{guarddoviConfig.count>=8else{returnnil}letb=[UInt8](doviConfig)letdvVersionMajor=b[0]letdvVersionMinor=b[1]letdvProfile=b[2]letdvLevel=b[3]letrpuPresentFlag=b[4]letelPresentFlag=b[5]letblPresentFlag=b[6]letdvBlSignalCompatibilityId=b[7]
// Match VidCore behavior: do not emit dvcC for Profile 7 as VideoToolbox breaks with dual-layer files.
ifdvProfile==7{returnnil}vardvcC=[UInt8](repeating:0,count:24)dvcC[0]=dvVersionMajordvcC[1]=dvVersionMinordvcC[2]=(dvProfile<<1)|((dvLevel>>5)&0x01)dvcC[3]=((dvLevel&0x1F)<<3)|((rpuPresentFlag&0x01)<<2)|((elPresentFlag&0x01)<<1)|(blPresentFlag&0x01)dvcC[4]=(dvBlSignalCompatibilityId&0x0F)<<4returnData(dvcC)}
ie. you allocate a 24-byte dvcC payload and fill bytes 0...4 with parsed DoVi fields, rest remain zeroed. FFmpeg gives you AV_PKT_DATA_DOVI_CONF.
Thanks for the test files. After building a "dvvC" or "dvcC" atom from AVDOVIDecoderConfigurationRecord AVFoundation+VideoToolbox render the Dolby files fine.
However FFmpeg doesn't see any Dolby Vision data in your test file (AVCodecParameters doesn't contain any AVDOVIDecoderConfigurationRecord side data), and I can't see any other way to tell this apart from vanilla HEVC. VideoToolbox refuses to render it as plain HEVC. How was this encoded?
(I'm reluctant to add libplacebo as a dependency because it drags in so many other dependencies. As long as I can get VideoToolbox to do the decode I think I can avoid it).
I have no idea how it was encoded, it was found on the high seas (which is why I deleted the earlier comment). I just clipped 10 seconds out a random movie. I can assure you that you absolutely do not need libplacebo. I wrangled my own code into a demux-only Media Extension and I can play the file properly.
Step 1 here is the important bit. That file's HEVC parameter sets are in-band rather than in the container header so in my code I resort to synthesising the hvcC atom.
Added support for Dolby Vision in Matroska/HEVC in Release 3.01. This only works for well-formed files that contain a AVDOVIDecoderConfigurationRecord in FFmpeg. (I tried synthesizing this if absent from per-frame metadata but was unsuccessful).
Thanks @ptaru for your help.
Activity
ptaru commentedon Feb 12, 2026
I have a reasonably robust implementation of demuxing mkv -> directly passing sample buffers to AVSBDL in https://github.com/ptaru/VidCore that you're free to use. License is LGPL which should be compatible with QLVideo's GPL.
Marginal commentedon Feb 12, 2026
I'm creating sample description atoms for VideoToolbox here, but not for dvcC.
I'll take a look at your code, thanks. Do you have any links to documentation on what a dvcC atom should contain?
ptaru commentedon Feb 12, 2026
There's no good documentation since it's proprietary. I just studied libdovi code and inspected what AVAssetReader does with MP4 files. Basic implementation looks like this:
ie. you allocate a 24-byte dvcC payload and fill bytes 0...4 with parsed DoVi fields, rest remain zeroed. FFmpeg gives you AV_PKT_DATA_DOVI_CONF.
Marginal commentedon Feb 12, 2026
Thanks again. I also found https://professionalsupport.dolby.com/s/article/How-to-signal-Dolby-Vision-in-ISOBMFF-format-AKA-mp4-container
Marginal commentedon Feb 13, 2026
Thanks for the test files. After building a "dvvC" or "dvcC" atom from AVDOVIDecoderConfigurationRecord AVFoundation+VideoToolbox render the Dolby files fine.
However FFmpeg doesn't see any Dolby Vision data in your test file (AVCodecParameters doesn't contain any AVDOVIDecoderConfigurationRecord side data), and I can't see any other way to tell this apart from vanilla HEVC. VideoToolbox refuses to render it as plain HEVC. How was this encoded?
(I'm reluctant to add libplacebo as a dependency because it drags in so many other dependencies. As long as I can get VideoToolbox to do the decode I think I can avoid it).
ptaru commentedon Feb 13, 2026
I have no idea how it was encoded, it was found on the high seas (which is why I deleted the earlier comment). I just clipped 10 seconds out a random movie. I can assure you that you absolutely do not need libplacebo. I wrangled my own code into a demux-only Media Extension and I can play the file properly.
Step 1 here is the important bit. That file's HEVC parameter sets are in-band rather than in the container header so in my code I resort to synthesising the hvcC atom.
Support for Dolby Vision in Matroska files
Support for Dolby Vision in Matroska files
Marginal commentedon Feb 16, 2026
Added support for Dolby Vision in Matroska/HEVC in Release 3.01. This only works for well-formed files that contain a AVDOVIDecoderConfigurationRecord in FFmpeg. (I tried synthesizing this if absent from per-frame metadata but was unsuccessful).
Thanks @ptaru for your help.