AVMutableVideoComposition Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 4.0 and later.
Declared in
AVVideoComposition.h
Related sample code

Overview

The AVMutableVideoComposition class is a mutable subclass of AVVideoComposition.

A video composition describes, for any time in the aggregate time range of its instructions, the number and IDs of video tracks that are to be used in order to produce a composed video frame corresponding to that time. When AV Foundation’s built-in video compositor is used, the instructions an AVVideoComposition comprises can specify a spatial transformation, an opacity value, and a cropping rectangle for each video source, and these can vary over time via simple linear ramping functions.

You can also implement your own custom video compositor by implementing the AVVideoCompositing protocol; a custom video compositor is provided with pixel buffers for each of its video sources during playback and other operations and can perform arbitrary graphical operations on them in order to produce visual output.

Tasks

Creating a Video Composition

Getting and Setting Video Composition Properties

Managing the Custom Video Compositor

Properties

animationTool

A special video composition tool for use with Core Animation.

@property(nonatomic, retain) AVVideoCompositionCoreAnimationTool *animationTool
Discussion

This attribute may be nil.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVVideoComposition.h

customVideoCompositorClass

The custom compositor class to use, if any.

@property(nonatomic, retain) Class<AVVideoCompositing> *customVideoCompositorClass
Discussion

The default value is nil, indicating that the internal video compositor is used

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

frameDuration

The interval for which the video composition should render composed video frames.

@property(nonatomic) CMTime frameDuration
Availability
  • Available in iOS 4.0 and later.
Declared In
AVVideoComposition.h

instructions

The video composition instructions.

@property(nonatomic, copy) NSArray *instructions
Discussion

The array contains of instances of AVVideoCompositionInstruction.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVVideoComposition.h

renderScale

The scale at which the video composition should render.

@property(nonatomic) float renderScale
Discussion

May only be other than 1.0 for a video composition set on an AVPlayerItem.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVVideoComposition.h

renderSize

The size at which the video composition should render.

@property(nonatomic) CGSize renderSize
Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
AVVideoComposition.h

Class Methods

videoComposition

Returns a new mutable video composition.

+ (AVMutableVideoComposition *)videoComposition
Return Value

A newly created and initialized instance of AVMutableVideoComposition.

Discussion

The returned AVMutableVideoComposition has the following properties:

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
AVVideoComposition.h

videoCompositionWithPropertiesOfAsset:

Returns a new mutable video composition with the specified asset properties.

+ (AVMutableVideoComposition *)videoCompositionWithPropertiesOfAsset:(AVAsset *)asset
Parameters
asset

An instance of AVAsset. Ensure that the duration and tracks properties of the asset are already loaded before invoking this method.

Return Value

A newly created and initialized instance of AVMutableVideoComposition.

Discussion

The returned AVMutableVideoComposition has instructions that respect the spatial properties and time ranges of the specified asset's video tracks.

It also has the following values for its properties:

Availability
  • Available in iOS 6.0 and later.
Declared In
AVVideoComposition.h