Learn about the usage and requirements of “Ambient Viewing Environment” metadata with Dolby Vision™ Profile 8.4 playback.
TN3145: HDR video metadata
Add a Comment
Learn about the usage and requirements of “Ambient Viewing Environment” metadata with Dolby Vision™ Profile 8.4 playback.
How to attach ambientViewingEnvironment to new pixel buffer as attachment? I tried many things but it fails.
Update: It seems the attachment needs to be copied as NSData, example
CVBufferSetAttachment(pixelBuffer, kCVImageBufferAmbientViewingEnvironmentKey, ambientViewingEnvironmentData! as NSData, .shouldPropagate)
Thanks for the feedback. We'll look to update the TN to address this.
Doesn't work on iOS 17 it seems! ambientViewingEnvironmentData
is nil.
@Jason It seems AVAssetWriter is crashing with error -12743 when appending NSData
for kCVImageBufferAmbientViewingEnvironmentKey
. Please describe how exactly to copy this attachment to new pixel buffer. Here is my code:
var ambientViewingEnvironment:CMFormatDescription.Extensions.Value?
var ambientViewingEnvironmentData:NSData?
ambientViewingEnvironment = sampleBuffer.formatDescription?.extensions[.ambientViewingEnvironment]
let plist = ambientViewingEnvironment?.propertyListRepresentation
ambientViewingEnvironmentData = plist as? NSData
And then attaching this data,
CVBufferSetAttachment(renderedPixelBuffer, kCVImageBufferAmbientViewingEnvironmentKey, ambientViewingEnvironmentData! as CFData, .shouldPropagate)