我使用以下设置使录制的音频文件更小
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。有谁知道他们是如何做到这一点的?或者有没有人有想法如何进一步缩小尺寸?谢谢。
答案 0 :(得分:0)
[settings setValue :[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
kAudioFormatMPEG4AAC 的尺寸最小。
然后你可以将文件分成多个小块。如需参考,请参阅以下链接:
http://sspbond007.blogspot.in/2012/01/objective-c-filesplitter-and-joiner.html