Protocol

AVVideoCompositing

The methods that custom video compositors must implement.

Declaration

protocol AVVideoCompositing

Overview

For each AVFoundation object of class AVPlayerItem, AVAssetExportSession, AVAssetImageGenerator, or AVAssetReaderVideoCompositionOutput that has a non-nil value for its videoComposition property, and the value of the customVideoCompositorClass property of the AVVideoComposition is not nil, AVFoundation creates and uses an instance of that custom video compositor class to process the instructions contained in the AVVideoComposition.

The system creates a custom video compositor instance when you assign videoComposition an instance of AVVideoComposition that's associated with a different custom video compositor class than the object was previously using.

When creating instances of custom video compositors, AVFoundation initializes them by calling init and then makes them available as the value of the customVideoCompositor property of the object. You then can do any additional setup or configuration to the custom compositor.

The AVFoundation object retains the custom video compositor instances for as long as the value of the videoComposition property indicates that there is an instance of the same custom video compositor class. This is true even when the value changes from one instance of AVVideoComposition to another associated instance with the same custom video compositor class.

Topics

Rendering the Composition

func startRequest(AVAsynchronousVideoCompositionRequest)

Directs a custom video compositor object to create a new pixel buffer composed asynchronously from a collection of sources.

Required.

func cancelAllPendingVideoCompositionRequests()

Directs a custom video compositor object to cancel or finish all pending video composition requests.

Render Context Settings

func renderContextChanged(AVVideoCompositionRenderContext)

Notifies the custom compositor that a composition will switch to a different render context.

Required.

var supportsWideColorSourceFrames: Bool

A Boolean value that indicates whether the client can handle frames that contain wide color properties.

Pixel Buffer Attributes

var requiredPixelBufferAttributesForRenderContext: [String : Any]

The pixel buffer attributes required by the video compositor for new buffers created for processing.

Required.

var sourcePixelBufferAttributes: [String : Any]?

The types of source frame pixel buffer attributes a video compositor can accept as input.

Required.

Relationships

Inherits From

See Also

Configuring an Item's Settings

var audioMix: AVAudioMix?

The audio mix parameters to be applied during playback.

var videoComposition: AVVideoComposition?

The video composition settings to be applied during playback.

var seekingWaitsForVideoCompositionRendering: Bool

A Boolean value that indicates whether the item’s timing follows the displayed video frame when seeking with a video composition.

var audioTimePitchAlgorithm: AVAudioTimePitchAlgorithm

The processing algorithm used to manage audio pitch for scaled audio edits.

var videoApertureMode: AVVideoApertureMode

The video aperture mode to apply during playback.

struct AVVideoApertureMode

A value that describes how a video is scaled or cropped.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software