I have the following audio compression settings which fail with AVAssetWriter (mov
container, HEVC codec, kAudioFormatMPEG4AAC
format ID):
["AVSampleRateKey": 48000, "AVFormatIDKey": 1633772320, "AVNumberOfChannelsKey": 1, "AVEncoderBitRatePerChannelKey": 128000, "AVChannelLayoutKey": <02006500 00000000 00000000 00000000 00000000 00000000 00000000 00000000>]
Here is the code line that fails:
if _assetWriter?.canApply(outputSettings: audioSettings!, forMediaType: AVMediaType.audio) ?? false {
} else {
/* Failure */
}
Want to understand what is wrong? I can not reproduce it at my end (only reproducible on user's device with a particular microphone).
I need to know if it is mandatory to provide value for AVChannelLayoutKey
in the dictionary with kAudioFormatMPEG4AAC
? That could be a possible culprit.