I tried adding watermarks to the recorded video. Appending sample buffers using AVAssetWriterInput's append method fails and when I inspect the AVAssetWriter's error property, I get the following:
Error Domain=AVFoundation Error Domain Code=-11800 "This operation cannot be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-12780), NSLocalizedDDescription=This operation cannot be completed, NSUnderlyingError=0x302399a70 {Error Domain=NSOSStatusErrorDomain Code=-12780 "(null)"}}
As far as I can tell -11800 indicates an AVErrorUknown, however I have not been able to find information about the -12780 error code, which as far as I can tell is undocumented.
Thanks!
Hello @HeYingJian,
Your issue stems from the topic mentioned in this TN3177: Understanding alternate audio track groups in movie files.
In short, iPhone 16 and iPhone 16 Pro can record a stereo and Spatial track for the same movie. It is incorrect to mix those tracks together. Your app is mixing them together with AVAssetReaderAudioMixOutput, and that is resulting in this issue.
-- Greg