Is there a way to write custom metadata to individual video frames with AVFoundation?

Viewed 182

I am recording video within my iOS app, and I need to write a small amount of metadata to some of the video frames as they get recorded.

Is there a way to do this?

I currently have my AVCaptureVideoDataOutput and AVCaptureVideoDataOutputSampleBufferDelegate set up. I also have this method being successfully called, and I think this is where the metadata writing should happen (maybe not) but I'm not sure how to do it:

func captureOutput(_ output: AVCaptureOutput, 
                  didOutput sampleBuffer: CMSampleBuffer, 
                       from connection: AVCaptureConnection)

If writing frame metadata is possible, could you provide a come sample? I've seen some theoretical explanations, but nothing concrete.

This question and answer refers to writing metadata to the whole video, but I need to write it to individual video frames: Add custom metadata to video using AVFoundation

0 Answers
Related