Many thanks Greg !!
For anyone else looking into this, the CMMetadataFormatDescription is a bit special and perhaps not very Swifty ;) Working example below:
// Add an metadata input
let metaSpec : NSDictionary = [
kCMMetadataFormatDescriptionMetadataSpecificationKey_Identifier as NSString:
AVMetadataIdentifier.quickTimeMetadataLocationNote,
kCMMetadataFormatDescriptionMetadataSpecificationKey_DataType as NSString:
kCMMetadataBaseDataType_UTF8]
var metaFormat : CMFormatDescription? = nil
CMMetadataFormatDescriptionCreateWithMetadataSpecifications(allocator: kCFAllocatorDefault, metadataType: kCMMetadataFormatType_Boxed, metadataSpecifications: [metaSpec] as CFArray, formatDescriptionOut: &metaFormat)
let assetWriterMetaDataInput = AVAssetWriterInput(mediaType: .metadata, outputSettings: nil, sourceFormatHint: metaFormat)
assetWriterMetaDataInput.expectsMediaDataInRealTime = true
assetWriter.add(assetWriterMetaDataInput)
Topic:
Media Technologies
SubTopic:
Video
Tags: