iOS Developer Library

Developer

AV Foundation Framework Reference AVMutableVideoComposition Class Reference

Options
Deployment Target:

On This Page
Language:

AVMutableVideoComposition

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.

  • Returns a new mutable video composition.

    Declaration

    Objective-C

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

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

    Declaration

    Swift

    init(propertiesOfAsset asset: AVAsset)

    Objective-C

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