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


@interface AVMutableComposition : AVComposition


This class provides the ability to add and remove tracks, and you can add, remove, and scale time ranges. You can make an immutable snapshot of a mutable composition for playback or inspection as follows:

AVMutableComposition *myMutableComposition =
    <#a mutable composition you want to inspect or play in its current state#>;
AVComposition *immutableSnapshotOfMyComposition = [myMutableComposition copy];
// Create a player to inspect and play the composition.
AVPlayerItem *playerItemForSnapshottedComposition =
    [[AVPlayerItem alloc] initWithAsset:immutableSnapshotOfMyComposition];


Creating a Mutable Composition

+ compositionWithURLAssetInitializationOptions:

Returns a new, empty, mutable composition.

+ composition

Returns a new, empty, mutable composition.

Managing Time Ranges

- insertEmptyTimeRange:

Adds or extends an empty time range within all tracks of the composition.

- insertTimeRange:ofAsset:atTime:error:

Inserts all the tracks within a given time range of a specified asset into the receiver.

- removeTimeRange:

Removes a specified time range from all tracks of the composition.

- scaleTimeRange:toDuration:

Changes the duration of all tracks in a given time range.

Managing Tracks


An array of mutable composition tracks contained by the composition.

- addMutableTrackWithMediaType:preferredTrackID:

Adds an empty track to the receiver.

- removeTrack:

Removes a specified track from the receiver.

- mutableTrackCompatibleWithTrack:

Returns a track in the receiver into which any time range of a given asset track can be inserted.

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

Configuring Video Size


The encoded or authored size of the visual portion of the asset.


Inherits From

See Also

Media Composition


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


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 track in a composition object that you use to insert, remove, and scale track segments without affecting their low-level representation.