AVAssetReaderVideoCompositionOutput Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 4.1 and later.
Declared in
AVAssetReaderOutput.h

Overview

AVAssetReaderVideoCompositionOutput is a subclass of AVAssetReaderOutput you use to read video frames that have been composited together from the frames in one or more tracks of an AVAssetReader object's asset.

You can read the video frames composited from one or more asset tracks by adding an instance of AVAssetReaderVideoCompositionOutput to an AVAssetReader object using the addOutput: method.

AVAssetReaderVideoCompositionOutput can only produce uncompressed output.  This means that the videoSettings dictionary must follow the rules for uncompressed video output.  In addition, the following keys are not supported: AVVideoCleanApertureKey, AVVideoPixelAspectRatioKey, AVVideoScalingModeKey, and AVVideoColorPropertiesKey.

Tasks

Creating a Video Composition Output

Video Properties

Properties

customVideoCompositor

Returns the custom video compositor instance used by the receiver, if any. (read-only)

@property(nonatomic, readonly) id<AVVideoCompositing> customVideoCompositor
Discussion

The custom video compositor instance that is used during image generation is accessible via this property after the value of videoComposition is set to an AVVideoComposition instance that specifies a custom video compositor class. Any additional communication between the application and that instance of the custom video compositor, if any is required for configuration or other purposes, can only occur once that has happened.

If the value of videoComposition is changed from an AVVideoComposition that specifies a custom video compositor class to another instance of AVVideoComposition that specifies the same custom video compositor class, the instance of the custom video compositor that was previously created will receive the renderContextChanged: message and remain in use for subsequent image generation.

This property is nil if there is no video compositor, or if the internal video compositor is in use.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVAssetReaderOutput.h

videoComposition

The video composition to use for the output.

@property(nonatomic, copy) AVVideoComposition *videoComposition
Discussion

The value is an AVVideoComposition object that can be used to specify the visual arrangement of video frames read from each source track over the timeline of the source asset.

See AVVideoComposition for options for configuring a video composition.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVAssetReaderOutput.h

videoSettings

The video settings used by the output. (read-only)

@property(nonatomic, readonly) NSDictionary *videoSettings
Discussion

The dictionary’s keys are specified in CVPixelBufferRef.

A value of nil indicates that the receiver will return video frames in a convenient uncompressed format, with properties determined according to the properties of the receiver's video tracks.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVAssetReaderOutput.h

videoTracks

The tracks from which the output reads composited video. (read-only)

@property(nonatomic, readonly) NSArray *videoTracks
Discussion

The array contains AVAssetTrack objects owned by the target asset reader’s asset.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVAssetReaderOutput.h

Class Methods

assetReaderVideoCompositionOutputWithVideoTracks:videoSettings:

Returns an instance of AVAssetReaderVideoCompositionOutput for reading composited video from the specified video tracks, using optional video settings.

+ (AVAssetReaderVideoCompositionOutput *)assetReaderVideoCompositionOutputWithVideoTracks:(NSArray *)videoTracks videoSettings:(NSDictionary *)videoSettings
Parameters
videoTracks

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

It is an error to include tracks of media types other than AVMediaTypeVideo.

videoSettings

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 CVPixelBufferRef, 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.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVAssetReaderOutput.h

Instance Methods

initWithVideoTracks:videoSettings:

Initializes an instance of AVAssetReaderVideoCompositionOutput for reading composited video from the specified video tracks, using optional video settings.

- (id)initWithVideoTracks:(NSArray *)videoTracks videoSettings:(NSDictionary *)videoSettings
Parameters
videoTracks

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.

videoSettings

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 CVPixelBufferRef, 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.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVAssetReaderOutput.h