CMSampleBufferGetImageBuffer(sampleBuffer)! let pixelBuffer = imageBuffer as CVPixelBuffer let renderer = UIGraphicsImageRenderer(size: renderingSize) let image = renderer.image { context in view.layer.draw(in: context) } if let cgImage = image.cgImage { cicontext.render(CIImage(cgImage: cgImage), to: pixelBuffer) } ɾUIView → UIImage → CVPixelBuffer → CMSampleBuffer