【问题标题】:How to record audio as mp3 file by using AvAudiorecorder in iOS如何在 iOS 中使用 AvAudiorecorder 将音频录制为 mp3 文件
【发布时间】:2012-05-06 01:40:09
【问题描述】:

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

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

【问题讨论】:

标签: iphone record avaudiorecorder


【解决方案1】:

添加

[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey

但是,由于版税的原因,无法在 iPhone 上对 mp3 格式进行编码。

【讨论】:

  • 感谢您的反馈我使用了这个,但我收到错误“错误域=NSOSStatusErrorDomain Code=1718449215”操作无法完成。 (OSStatus 错误 1718449215。)”。请提供完整的设置代码,如果可能的话,提前谢谢。
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-03
    • 1970-01-01
    • 2012-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-19
    相关资源
    最近更新 更多