I\'m recording video and audio using AVCaptureVideoDataOutput
and AVCaptureAudioDataOutput
and in the captureOutput:didOutputSampleBuffer:fromCon
I asked Apple DTS about this same issue as all approaches I had were running really slow or doing odd things and they sent me this:
https://developer.apple.com/documentation/avfoundation/avasynchronousciimagefilteringrequest?language=objc
Which got me to a working solution really quickly! you can bypass the CVPixelBuffer altogether using CIFilters, which IMHO is much easier to work with. So if you don't actually NEED to use CVPixelBuffer, then this approach will become your new friend quickly.
A combination of CIFilter(s) to composite the source image and the image with the text I generated for each frame did the trick.
I hope this helps someone else!