从captureOutput中捕获的帧制作视频:didOutputSampleBuffer:fromConnection

时间:2013-11-22 15:09:21

标签: ios avcapture

如何从中捕获的帧制作电影 -captureOutput:didOutputSampleBuffer:fromConnection 并保存到照片库?

谢谢。

1 个答案:

答案 0 :(得分:0)

抱歉,我没有注意到。看到编辑过的答案,也许你觉得它很有用。

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
        CVPixelBufferRef pixelBuffer = (CVPixelBufferRef) CMSampleBufferGetImageBuffer(sampleBuffer);
        CIImage *image = [CIImage imageWithCVPixelBuffer:pixelBuffer];
        [_coreImageContext drawImage:image inRect:[image extent] fromRect:[image extent]];
        [_context presentRenderbuffer:GL_RENDERBUFFER ];
    }