首页 > 音频用什么压缩格式

音频用什么压缩格式

微信,陌陌那种语音聊天,一般音频用什么压缩格式


1. 米聊听说是iphone和android都是客户端用speex,压缩。尺寸应该很小,60s在20K左右
2. 微信听说是AMR,没测试,可以抓包看看。
3. 陌陌听说是wav,文件大了去了

我最近在做的一个即时通信app,客户端只录音,没有对语音处理,服务端处理各种,例如降噪等。
iOS的录音设置:

NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
                              [NSNumber numberWithFloat:8000],                  AVSampleRateKey, // 电话所用采样率
                              [NSNumber numberWithInt:kAudioFormatMPEG4AAC],    AVFormatIDKey,
                              [NSNumber numberWithInt:1],                       AVNumberOfChannelsKey,
                              [NSNumber numberWithInt:16],                      AVLinearPCMBitDepthKey,
                              [NSNumber numberWithInt:AVAudioQualityMin],       AVEncoderAudioQualityKey,
                              nil];

应该说这种聊天选择占用内存最小的格式吧,涉及到上传。我没有ios微信,不过我猜测,把后缀名改为caf应该可以打开,caf基本上相当于一个万能的容器,几乎什么格式都能放进去。

小生以ios为例,AVAudioRecorder录制的最小格式应该为这种参数:

[NSNumber numberWithFloat: 16000.0],AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatMPEG4AAC],AVFormatIDKey,
[NSNumber numberWithInt: 1],AVNumberOfChannelsKey,

微信ios用的是无法打开的aud格式,各种工具都无效。
微信安卓用的貌似是amr格式。


我的设置给你参考下,m4a格式,音质可以说算好了,20秒40k,2秒也是40k,更长时间忘了多大了,反正比上传图片流量小很多

NSMutableDictionary* recordSetting = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                              [NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
                                              [NSNumber numberWithFloat:44100.0], AVSampleRateKey,
                                              [NSNumber numberWithInt:1], AVNumberOfChannelsKey,
                                              [NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
                                              [NSNumber numberWithInt:AVAudioQualityMin], AVSampleRateConverterAudioQualityKey,
                                              [NSNumber numberWithInt:8], AVLinearPCMBitDepthKey,
                                              nil];
【热门文章】
【热门文章】