CMSampleBufferRef转UIImage

//CMSampleBufferRef=>UIImage
- (UIImage *)imageConvert:(CMSampleBufferRef)sampleBuffer
{
  
    if (!CMSampleBufferIsValid(sampleBuffer)) {
        return nil;
    }
    CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CMSampleBufferGetImageBuffer(sampleBuffer);
    
    CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
    
    UIImage *image = [UIImage imageWithCIImage:ciImage];
    return image;
}

你可能感兴趣的:(CMSampleBufferRef转UIImage)