0

我使用以下设置使录制的音频文件更小

NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithCapacity:0];                                                                              
[settings setValue :[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
[settings setValue:[NSNumber numberWithFloat:8000.0] forKey:AVSampleRateKey]; 
[settings setValue:[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey];
[settings setValue :[NSNumber numberWithInt:8] forKey:AVLinearPCMBitDepthKey];
[settings setValue :[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
[settings setValue :[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];
//Encoder
[settings setValue :[NSNumber numberWithInt:12000] forKey:AVEncoderBitRateKey];
[settings setValue :[NSNumber numberWithInt:8] forKey:AVEncoderBitDepthHintKey];    [settings setValue :[NSNumber numberWithInt:8] forKey:AVEncoderBitRatePerChannelKey];
[settings setValue :AVAudioQualityMin forKey:AVEncoderAudioQualityKey];

但是,对于 60 秒的声音,我需要 100K 左右,而微信只需要 30K 左右。有谁知道他们是如何做到这一点的?或者有人知道如何进一步压缩尺寸吗?谢谢你。

4

1 回答 1

0
[settings setValue :[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];

kAudioFormatMPEG4AAC的尺寸最小。

然后你可以将文件分成多个小块。有关参考,请参阅以下链接:

http://sspbond007.blogspot.in/2012/01/objective-c-filesplitter-and-joiner.html

于 2013-09-16T11:56:50.753 回答