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.
On This Page
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];
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.
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.
var tracks: [AVMutableCompositionTrack]
An array of AVMutableCompositionTrack objects contained by the composition.
func addMutableTrack(withMediaType: String, preferredTrackID: CMPersistentTrackID)
Adds an empty track to the receiver.
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.
var naturalSize: CGSize
The encoded or authored size of the visual portion of the asset.
init(urlAssetInitializationOptions: [String : Any]? = nil)
func track(withTrackID: CMPersistentTrackID)
func tracks(withMediaCharacteristic: String)
func tracks(withMediaType: String)