My goal is to process images from camera with Vision framework, add overlay images and record video with overlay images.
One way I found is with AVCaptureSession, with SampleBufferDelegate where in function
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)
image by image is processed, added overlay image and passed to AVAssetWriter to create video.
However, problem with this implementation is it can't be run in realtime because app become sluggish.
Is there better and faster way to do this?