AVAssetWriter error -12870 after building with XCode 13

The AppStore version of my app works perfectly fine. But the moment I build the same code with XCode 13, AVAssetWriter fails with errors at the very beginning itself both on iOS 14 and iOS 15. This happens with Multicam session only.

Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-12780)

I am wondering what could be wrong. I even passed default settings to AVAssetWriter (the recommended ones).

Update: It turned out to be an issue with audio settings.

I'm glad you figured it out. Would you mind filing a report using the feedback assistant so we can provide a more actionable error? Thanks.

Yes, it would be very helpful to know what has caused the error, and it took hours to figure out number of audio channels passed in audio compression settings were wrong.

AVAssetWriter error -12870 after building with XCode 13
 
 
Q