Class

AVMutableComposition

AVMutableComposition is a mutable subclass of AVComposition you use when you want to create a new composition from existing assets. You can add and remove tracks, and you can add, remove, and scale time ranges.

Overview

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];

Topics

Managing Time Ranges

func insertEmptyTimeRange(CMTimeRange)

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

func insertTimeRange(CMTimeRange, of: AVAsset, at: CMTime)

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

func removeTimeRange(CMTimeRange)

Removes a specified timeRange from all tracks of the composition.

func scaleTimeRange(CMTimeRange, toDuration: CMTime)

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

Managing Tracks

var tracks: [AVMutableCompositionTrack]

An array of AVMutableCompositionTrack objects contained by the composition.

func removeTrack(AVCompositionTrack)

Removes a specified track from the receiver.

func mutableTrack(compatibleWith: AVAssetTrack)

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

Video Size

var naturalSize: CGSize

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

Relationships

Inherits From

Conforms To