最近用lame将ios录制语音转换成MP3时,播放时间变短,在iOS端是好的,到android时,时长变短。
后来发现是录音时和转码时的配置问题,以下是我的配置
录音时
NSURL* fileUrl = [NSURL fileURLWithPath:self.filePath];
NSDictionary * soundSetting;
soundSetting = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:8000.0f],AVSampleRateKey,
[NSNumber numberWithInt:2],AVNumberOfChannelsKey,
[NSNumber numberWithInt:AVAudioQualityHigh],AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],AVEncoderBitRateKey,
nil];
NSError* error;
self.audioRecorder = [[AVAudioRecorder alloc]initWithURL:fileUrl settings:soundSetting error:&error ];
//开始录音
AVAudioSession * audioSession = [AVAudioSession sharedInstance];
[audioSession setC