我试图使用AVAssetWriter从图像创建视频.实现的代码大部分时间工作正常,但在随机时刻,作者有问题
AVAssetWriter *videoWriter; ... [videoWriter finishWriting]; NSLog(@"videoWriter error %@",videoWriter.error);
收到的错误是:
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1f839cd0 {NSLocalizedDescription=The operation could not be completed,NSUnderlyingError=0x1e59efb0 "The operation couldn’t be completed. (OSStatus error -12633.)",NSLocalizedFailureReason=An unknown error occurred (-12633)}
写图像:
-(void)writeFrame:(WriteableFrame*)wF { if([writerInput isReadyForMoreMediaData]) { CMTime presentTime = CMTimeMake(wF.frameTime,1000); CGImageRef tmpImgRef = [wF.currentImage CGImage]; buffer = [self pixelBufferFromCGImage:tmpImgRef]; if(buffer) { [adaptor appendPixelBuffer:buffer withPresentationTime:presentTime]; CVPixelBufferRelease(buffer); } } else { NSLog(@"error"); } }
有人有这样的问题吗?
解决方法
我发现这个问题,它在同一帧时间放置了两帧.