createMetadataSampleBuffer(from:forDuration:)
Creates a sample buffer containing Timecode Media Description metadata for a specified duration.
Declaration
static func createMetadataSampleBuffer(from timecode: AVCaptureTimecode, forDuration duration: CMTime) -> Unmanaged<CMSampleBuffer>?Parameters
- timecode:
The Avcapturetimecode instance providing the timecode details for the metadata sample.
- duration:
The duration that the metadata sample buffer should represent.
Return Value
A CMSampleBufferRef with encoded Timecode Media Description metadata for the given duration, or nil if sample buffer creation fails.
Discussion
Use this function for scenarios where timecode metadata needs to span a custom interval (not just a single frame), such as non-frame-accurate workflows or for describing a segment of media with a consistent timecode.