An object that combines media data from multiple file-based sources to present or process media data from multiple sources.


@interface AVComposition : AVAsset


At its top-level, AVComposition is a collection of tracks, each presenting media of a specific media type, e.g. audio or video, according to a timeline. Each track is represented by an instance of AVCompositionTrack. Each track is comprised of an array of track segments, represented by instances of AVCompositionTrackSegment. Each segment presents a portion of the media data stored in a source container, specified by URL, a track identifier, and a time mapping. The URL specifies the source container, and the track identifier indicates the track of the source container to be presented. All file-based audiovisual assets are eligible to be combined, regardless of container type.

The time mapping specifies the temporal range of the source track that's to be presented and also specifies the temporal range of its presentation in the composition track. If the durations of the source and destination ranges of the time mapping are the same, the media data for the segment will be presented at its natural rate. Otherwise, the segment will be presented at a rate equal to the ratio source.duration / target.duration.

You can access the track segments of a track using the segments property (an array of AVCompositionTrackSegment objects) of AVCompositionTrack. The collection of tracks with media type information for each, and each with its array of track segments (URL, track identifier, and time mapping), form a complete low-level representation of a composition. This representation can be written out by clients in any convenient form, and subsequently the composition can be reconstituted by instantiating a new AVMutableComposition with AVMutableCompositionTrack objects of the appropriate media type, each with its segments property set according to the stored array of URL, track identifier, and time mapping.

A higher-level interface for constructing compositions is also presented by AVMutableComposition and AVMutableCompositionTrack, offering insertion, removal, and scaling operations without direct manipulation of the trackSegment arrays of composition tracks. This interface makes use of higher-level constructs such as AVAsset and AVAssetTrack, allowing the client to make use of the same references to candidate sources that it would have created in order to inspect or preview them prior to inclusion in a composition.


Setting URL Initialization Options


The initialization options for the creation of URL assets by the receiver.

Accessing Tracks


An array of composition track objects contained by the composition.

- trackWithTrackID:

Provides a composition track associated with the specified track ID.

- tracksWithMediaCharacteristic:

Provides the composition tracks of the specified media characteristic associated with an asset.

- tracksWithMediaType:

Provides the composition tracks of the specified media type associated with an asset.

Getting the Natural Size of a Composition


The authored size of the visual portion of the composition.


Inherits From

Conforms To

See Also

Media Composition


A track in a composition object, consisting of a media type, a track identifier, and track segments.


A segment of a track, consisting of a URL, a track identifier, and a time mapping from the source track to the composition track.


A mutable object used to create a new composition from existing assets.


A mutable track in a composition object that you use to insert, remove, and scale track segments without affecting their low-level representation.