[英]how to record audio as mp3 file by using AvAudiorecorder
how to record audio as mp3 file by using AvAudiorecorder.im using following code for recorder setting 如何使用AvAudiorecorder.im将音频录制为mp3文件,使用以下代码进行录音机设置
recordSetting1 = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:AVAudioQualityMin],AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],
AVEncoderBitRateKey,
[NSNumber numberWithInt: 2],
AVNumberOfChannelsKey,
[NSNumber numberWithFloat:44100.0],
AVSampleRateKey,nil];
Add 加
[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey
However it's impossible to encode mp3 format at IPhone because of royalty. 然而,由于版税,在IPhone上编码mp3格式是不可能的。
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 ). 虽然您可以使用
AVAudioPlayer
播放MP3文件,但您无法使用AVAudioRecorder
以MP3格式AVAudioRecorder
(请参阅此SO帖子和此SO帖子 )。 If you need a compressed format, but it doesn't have to be MP3, I suggest recording in AAC format. 如果您需要压缩格式,但不一定是MP3,我建议以AAC格式录制。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.