AVAssetWriter NSOSStatusErrorDomain代码= -16155

时间:2018-10-10 20:32:40

标签: ios avassetwriter avassetwriterinput

录制长视频时出现错误。奇怪的是,这种情况总是在我录制大约1小时30分钟左右的记录后才会发生。

我正在使用AVAssetWriter录制视频和两条音轨。

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16155), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x282fe0e40 {Error Domain=NSOSStatusErrorDomain Code=-16155 "(null)"}})

我试图在https://www.osstatus.com/中找到此错误代码,但是没有运气。

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

我刚刚遇到了这个问题,似乎我对 AVAssetReaderTrackOutput 使用了错误的输出设置。

就我而言,我使用

let decompressionAudioSettings: [String: Any] = [AVFormatIDKey: Int(kAudioFormatLinearPCM)] 
audioReaderOutput = AVAssetReaderTrackOutput(track: audioTrack, outputSettings: decompressionAudioSettings)

let decompressionVideoSettings: [String: Any] = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA]
videoReaderOutput = AVAssetReaderTrackOutput(track: videoTrack, outputSettings: decompressionVideoSettings)