So I\'m using an AVAudioRecorder to record audio alongside an AVCaptureSession that is recording video (I know this is odd, but for my situation I need to record them sepera
It looks like it's actually an interaction between AVNumberOfChannelsKey
and AVEncoderBitRateKey
. I can't seem to record above 64000Kbps when the # of channels = 1, but when it = 2, I can use 128000...
I had this same problem - and the answer proved to be related to AVAudioSession. I needed to set the audio session category to PlayAndRecord. Other parts of my application were setting it to Ambient. This post https://stackoverflow.com/a/10287793/1009125 gave me the answer. Hope this helps someone, I lost a Sunday to this one.
Did some more digging and I apparently found the solution. I simply got rid of AVEncoderBitRateKey and everything works fine. So now my recordSettings dictionary looks like this:
// Setup audio recording
NSDictionary *recordSettings = @{AVFormatIDKey: @(kAudioFormatMPEG4AAC),
AVEncoderAudioQualityKey: @(AVAudioQualityLow),
AVNumberOfChannelsKey: @1,
AVSampleRateKey: @22050.0f};
Still not sure why this would be the case only on an iPhone 5S. Again, I've tested on all other devices running iOS6 and iOS7, and the old settings dictionary works fine on everything except for the 5S. Now that I've removed the AVEncoderBitRateKey and value, it also works on the 5S.