Hi,
I'm trying to use AVCaptureSession to capture the screen as a video stream. I've found that I can actually ask AVCaptureSession to output H264 directly through videoSetting on AVCaptureVideoDataOutput. After some profiling, I've found this has a much greater performance advantage over raw frames + VideoToolBox, some black magic must have done inside the AVCaptureSession so that the raw frames don't need to be transfered over to the VideoToolBox process, thus save a lot of CPU time.
However, as I'm developing a network streaming app, I need to be able to control when I need to send over a full frame (aka the I-frame). It's possible to do this through VideoToolBox's API: VTCompressionSessionEncodeFrame (frameProperties). But I didn't find anywhere I can plug in the same parameters inside AVCaptureSession.
So my questions:
I'm trying to use AVCaptureSession to capture the screen as a video stream. I've found that I can actually ask AVCaptureSession to output H264 directly through videoSetting on AVCaptureVideoDataOutput. After some profiling, I've found this has a much greater performance advantage over raw frames + VideoToolBox, some black magic must have done inside the AVCaptureSession so that the raw frames don't need to be transfered over to the VideoToolBox process, thus save a lot of CPU time.
However, as I'm developing a network streaming app, I need to be able to control when I need to send over a full frame (aka the I-frame). It's possible to do this through VideoToolBox's API: VTCompressionSessionEncodeFrame (frameProperties). But I didn't find anywhere I can plug in the same parameters inside AVCaptureSession.
So my questions:
Is it possible to ask AVCaptureSession to output an I-frame manually?
If not, is it possible to do what AVCaptureSession does to minimize CPU usage by avoiding transfering pixel data across IPC?