how to record audio as mp3 file by using AvAudiore

2019-02-13 17:54发布

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];

2条回答
We Are One
2楼-- · 2019-02-13 18:46

Add

[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey

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

查看更多
我只想做你的唯一
3楼-- · 2019-02-13 18:46

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.

查看更多
登录 后发表回答