如何使用AvAudiorecorder将音频录制为mp3文件

Alo*_*nha 7 iphone record avaudiorecorder

如何使用AvAudiorecorder.im将音频录制为mp3文件,使用以下代码进行录音机设置

recordSetting1 =  [NSDictionary dictionaryWithObjectsAndKeys:
                  [NSNumber numberWithInt:AVAudioQualityMin],AVEncoderAudioQualityKey,
                  [NSNumber numberWithInt:16], 
                   AVEncoderBitRateKey,
                   [NSNumber numberWithInt: 2], 
                   AVNumberOfChannelsKey,
                   [NSNumber numberWithFloat:44100.0], 
                   AVSampleRateKey,nil];
Run Code Online (Sandbox Code Playgroud)

nos*_*.dl 8

[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey
Run Code Online (Sandbox Code Playgroud)

然而,由于版税,在IPhone上编码mp3格式是不可能的.

  • 感谢您的反馈我使用此但我得到错误"错误域= NSOSStatusErrorDomain代码= 1718449215"操作无法完成.(OSStatus错误1718449215.)".请尽可能提前给我完整的设置代码. (6认同)

小智 6

虽然您可以使用 播放 MP3 文件AVAudioPlayer,但不能以 MP3 格式录制AVAudioRecorder(请参阅此 SO 帖子此 SO 帖子)。如果您需要压缩格式,但不一定是 MP3,我建议您以 AAC 格式录制。