问题
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