开发者

AudioStreamBasicDescription for mp3

开发者 https://www.devze.com 2023-03-09 19:42 出处:网络
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开发者_开发知识库n

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消