iOS Developer Library

Developer

AVFoundation Framework Reference AVMutableVideoComposition Class Reference

Options
Deployment Target:

On This Page
Language:

AVMutableVideoComposition

Inherits From


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 4.0 and later

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:

    Import Statement

    Objective-C

    @import AVFoundation;

    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!) -> AVMutableVideoComposition

    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:

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

  • The interval for which the video composition should render composed video frames.

    Declaration

    Swift

    var frameDuration: CMTime

    Objective-C

    @property(nonatomic) CMTime frameDuration

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 4.0 and later

  • The size at which the video composition should render.

    Declaration

    Swift

    var renderSize: CGSize

    Objective-C

    @property(nonatomic) CGSize renderSize

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 4.0 and later

  • The scale at which the video composition should render.

    Declaration

    Swift

    var renderScale: Float

    Objective-C

    @property(nonatomic) float renderScale

    Discussion

    May only be other than 1.0 for a video composition set on an AVPlayerItem.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 4.0 and later

  • The video composition instructions.

    Declaration

    Swift

    var instructions: [AnyObject]!

    Objective-C

    @property(nonatomic, copy) NSArray *instructions

    Discussion

    The array contains of instances of AVVideoCompositionInstruction.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 4.0 and later

  • A special video composition tool for use with Core Animation.

    Declaration

    Swift

    var animationTool: AVVideoCompositionCoreAnimationTool!

    Objective-C

    @property(nonatomic, retain) AVVideoCompositionCoreAnimationTool *animationTool

    Discussion

    This attribute may be nil.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 4.0 and later

  • The custom compositor class to use, if any.

    Declaration

    Swift

    var customVideoCompositorClass: AnyObject.Type!

    Objective-C

    @property(nonatomic, retain) Class< AVVideoCompositing > customVideoCompositorClass

    Discussion

    The default value is nil, indicating that the internal video compositor is used

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later