Render dynamic text onto CVPixelBufferRef while recording video

前端 未结 4 2103
隐瞒了意图╮
隐瞒了意图╮ 2021-02-09 17:15

I\'m recording video and audio using AVCaptureVideoDataOutput and AVCaptureAudioDataOutput and in the captureOutput:didOutputSampleBuffer:fromCon

4条回答
  •  Happy的楠姐
    2021-02-09 17:45

    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!

提交回复
热议问题