how to record audio as mp3 file by using AvAudiorecorder

佐手、 提交于 2019-12-19 02:38:33

问题


how to record audio as mp3 file by using AvAudiorecorder.i m using following code for recorder setting

recordSetting1 =  [NSDictionary dictionaryWithObjectsAndKeys:
                  [NSNumber numberWithInt:AVAudioQualityMin],AVEncoderAudioQualityKey,
                  [NSNumber numberWithInt:16], 
                   AVEncoderBitRateKey,
                   [NSNumber numberWithInt: 2], 
                   AVNumberOfChannelsKey,
                   [NSNumber numberWithFloat:44100.0], 
                   AVSampleRateKey,nil];

回答1:


Add

[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey

However it's impossible to encode mp3 format at IPhone because of royalty.




回答2:


Whilst you can play MP3 files using AVAudioPlayer, you can't record in MP3 format with AVAudioRecorder (see this SO post and this SO post). If you need a compressed format, but it doesn't have to be MP3, I suggest recording in AAC format.



来源:https://stackoverflow.com/questions/10314510/how-to-record-audio-as-mp3-file-by-using-avaudiorecorder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!