How to add custom udta atom on AVAssetWriter?

I'm using AVAssetWriter to write an AAC packaged in MP4 container. Pretty standard stuff. It is working well.


However, now I need to add an atom contained in the udta atom, so I have done this:


AVAssetWriter * writer =....

AVMutableMetadataItem * item = [AVMutableMetadataItem metadataItem];
item.keySpace = AVMetadataKeySpaceQuickTimeUserData; //udta
item.key = @"mine";
item.value = @"json data string";

writer.metadata = @[item];

[writer startWriting];
...


And then in the end, the udta atom doesn't appear at all in the output file. What is going wrong here?


I should mention this is iOS 9.3 SDK with Xcode 7.3.1

Answered by kcd in 186397022

I found the issue, if you are using AVFileTypeMPEG4, then non-standard atoms are dropped on the floor silently. So I switched the AVAssetWriter type to AVFileTypeQuickTimeMovie and it solved the issue.
Accepted Answer

I found the issue, if you are using AVFileTypeMPEG4, then non-standard atoms are dropped on the floor silently. So I switched the AVAssetWriter type to AVFileTypeQuickTimeMovie and it solved the issue.
How to add custom udta atom on AVAssetWriter?
 
 
Q