我在iOS上录制的aac音频文件有一些问题。我需要录制音频并用AVPlayer播放它。录制工作正常,文件已创建。我可以在Mac上播放。但是当我尝试在AVPlayer中播放它(文件)时-没有声音。
属性用于录制音频。
mRecordFormat.mSampleRate = 8000;
mRecordFormat.mFormatID = kAudioFormatMPEG4AAC;
mRecordFormat.mFormatFlags = kAudioFormatMPEG4AAC_LD;
mRecordFormat.mFramesPerPacket = 0;
mRecordFormat.mChannelsPerFrame = 1;
mRecordFormat.mBitsPerChannel = 0;
mRecordFormat.mBytesPerPacket = 0;我尝试了不同的设置,但没有结果。请帮帮忙
P.S.其他文件(mp3等)播放正常
发布于 2015-06-09 18:19:55
好吧,我几年前就找到了解决方案。我将记录逻辑更改为
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
[NSNumber numberWithFloat:16000], AVSampleRateKey,
[NSNumber numberWithInt:2], AVNumberOfChannelsKey,
[NSNumber numberWithInt:AVAudioQualityMedium], AVSampleRateConverterAudioQualityKey,
[NSNumber numberWithInt:64000], AVEncoderBitRateKey,
[NSNumber numberWithInt:8], AVEncoderBitDepthHintKey,
nil];
error = nil;
_recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error];这个录制的文件在iOS,Android和MacOS/Win上播放。这就是全部。
https://stackoverflow.com/questions/10428269
复制相似问题