iOS: Audio Recording File Format

前端 未结 3 1250
名媛妹妹
名媛妹妹 2020-12-14 03:31

I am implementing the Audio recording. It works fine with caf & wave format. But the problem is file size is too big.

So, can anyone h

3条回答
  •  太阳男子
    2020-12-14 04:25

    Here are my settings for high quality and small file size (on balance):

    NSDictionary *recordSettings = @{AVEncoderAudioQualityKey: @(AVAudioQualityMedium),
                                     AVFormatIDKey: @(kAudioFormatMPEG4AAC),
                                     AVEncoderBitRateKey: @(128000),
                                     AVNumberOfChannelsKey: @(1),
                                     AVSampleRateKey: @(44100)};
    

    This gives you a close to cd quality mono AAC track. You should append the file with .m4a to be readable everywhere. All other parameters get set to device defaults, which is what you want to happen in most cases.

提交回复
热议问题