0

我正在使用 AVCaptureSession 录制音频,并且在 10.9 之前一切正常。我设置了这些设置:

[newAudioSettings setValue:[NSNumber numberWithInt:kAudioFormatLinearPCM]     forKey:AVFormatIDKey];    
[newAudioSettings setValue:[NSNumber numberWithBool:NO]  forKey:AVLinearPCMIsBigEndianKey];
[newAudioSettings setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
[newAudioSettings setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];

并调用(当然,会话在调用它之前开始)

[audioFileOutput startRecordingToOutputFileURL:<File URL> outputFileType:AVFileTypeWAVE recordingDelegate:<delegate>];

这曾经很好用,但现在录制立即停止,并且 didFinishRecordingToOutputFileAtURL 的错误是:

Error Domain=AVFoundationErrorDomain Code=-11805 "Cannot Record" UserInfo=0x6180000ee580 {NSLocalizedFailureReason=The combination of audio file type and audio format in audioSettings is not supported, NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again., AVErrorRecordingSuccessfullyFinishedKey=false}

查看错误代码(-11805),它指出无法写入任何数据。看起来 wav 格式和这些设置之间存在一些不兼容,但我看不出是怎么回事。

有任何想法吗?

4

0 回答 0