I am trying to retrieve a CVPixelBufferRef from CMSampleBufferRef in-order to alter the CVPixelBufferRef to overlay a watermark on the fly.
I am using CMSampleBufferGetImageBuffer(sampleBuffer)
in-order to achieve that. I am printing the result of the returned CVPixelBufferRef, but its always null.
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
NSLog(@"PixelBuffer %@",pixelBuffer);
...
}
I there anything I am missing?