Compress IOSurface image

I test with ScreenCaptureKit example and success to get desktop image as IOSurface. I know IOSurface holds GPU memory and not easy to access as DRAM.

Do you know a way to h.264 compress the IOSurface? Or do I have to convert to CVPixelBuffer from IOSurface?

If you have any sample code for handling IOSurface, it would be useful to me.

Hello,

You can create a CVPixelBuffer from an IOSurface with CVPixelBufferCreateWithIOSurface(::::). Then, you can use VTCompressionSession to compress your frames.

Compress IOSurface image
 
 
Q