Creates an instance of a video composition output for reading composited video from the specified video tracks, using optional video settings.


init(videoTracks: [AVAssetTrack], videoSettings: [String : Any]?)



An array of AVAssetTrack objects from which the created object should read video frames for compositing.

Each track must be one of the tracks owned by the target asset reader’s asset and must be of media type AVMediaTypeVideo.


A dictionary of video settings to be used for sample output, or nil if you want to receive decoded samples in a convenient uncompressed format, with properties determined according to the properties of the specified video tracks.

You use keys from CVPixelBuffer, depending on the output format you want.

Initialization will fail if the video settings cannot be used with the specified video tracks.

Return Value

An instance of AVAssetReaderVideoCompositionOutput wrapping videoTracks, using the settings specified by videoSettings, or nil if initialization failed.