I have an Audio Queue working to record PCM, but I cannot get it to work for mp3. When I change the mFormatID to kAudioFormatMPEGLayer3, my callback function is never fired. I am usi开发者_开发知识库ng the example from the documentation.
The mp3 encoder is not bundled in iOS as far as I know as it's a patented algorithm. You can only decode (playback) mp3 audio.
Consider using ffmpeg or some other encoder on the server side to transform the audio to mp3.
Or get LAME (mp3 encoder) as listed in this answer.
Anurag is right: Core Audio won't encode MP3. Your approach will work for other CA-supported compressed codecs, like AAC and ALAC.
精彩评论