iOS Developer Library

Developer

AVFoundation Framework Reference AVMutableVideoCompositionLayerInstruction Class Reference

Options
Deployment Target:

On This Page
Language:

AVMutableVideoCompositionLayerInstruction

AVMutableVideoCompositionLayerInstruction is a mutable subclass of AVVideoCompositionLayerInstruction that is used to modify the transform, cropping, and opacity ramps to apply to a given track in a composition.

Inheritance


Import Statement


import AVFoundation @import AVFoundation;

Availability


Available in iOS 4.0 and later.
  • trackID trackID Property

    The trackID of the source track to which the compositor applies the instruction.

    Declaration

    Swift

    var trackID: CMPersistentTrackID

    Objective-C

    @property(nonatomic, assign) CMPersistentTrackID trackID

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 4.0 and later.

  • Sets a value of the opacity at a time within the time range of the instruction.

    Declaration

    Swift

    func setOpacity(_ opacity: Float, atTime time: CMTime)

    Objective-C

    - (void)setOpacity:(float)opacity atTime:(CMTime)time

    Parameters

    opacity

    The opacity to be applied at time. The value must be between 0.0 and 1.0.

    time

    A time value within the time range of the composition instruction.

    Discussion

    Sets a fixed opacity to apply from the specified time until the next time at which an opacity is set; this is the same as setting a flat ramp for that time range. Before the first time for which an opacity is set, the opacity is held constant at 1.0; after the last specified time, the opacity is held constant at the last value.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 4.0 and later.

  • Sets an opacity ramp to apply during a specified time range.

    Declaration

    Swift

    func setOpacityRampFromStartOpacity(_ startOpacity: Float, toEndOpacity endOpacity: Float, timeRange timeRange: CMTimeRange)

    Objective-C

    - (void)setOpacityRampFromStartOpacity:(float)startOpacity toEndOpacity:(float)endOpacity timeRange:(CMTimeRange)timeRange

    Parameters

    startOpacity

    The opacity to be applied at the start time of timeRange. The value must be between 0.0 and 1.0.

    endOpacity

    The opacity to be applied at the end time of timeRange. The value must be between 0.0 and 1.0.

    timeRange

    The time range over which the value of the opacity is interpolated between startOpacity and endOpacity.

    Discussion

    During an opacity ramp, opacity is computed using a linear interpolation. Before the first time for which an opacity is set, the opacity is held constant at 1.0; after the last specified time, the opacity is held constant at the last value.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 4.0 and later.

  • Sets a value of the transform at a time within the time range of the instruction.

    Declaration

    Swift

    func setTransform(_ transform: CGAffineTransform, atTime time: CMTime)

    Objective-C

    - (void)setTransform:(CGAffineTransform)transform atTime:(CMTime)time

    Parameters

    transform

    The transform to be applied at time.

    time

    A time value within the time range of the composition instruction.

    Discussion

    Sets a fixed transform to apply from the specified time until the next time at which a transform is set. This is the same as setting a flat ramp for that time range. Before the first specified time for which a transform is set, the affine transform is held constant at the value of CGAffineTransformIdentity; after the last time for which a transform is set, the affine transform is held constant at that last value.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 4.0 and later.

  • Sets a transform ramp to apply during a given time range.

    Declaration

    Swift

    func setTransformRampFromStartTransform(_ startTransform: CGAffineTransform, toEndTransform endTransform: CGAffineTransform, timeRange timeRange: CMTimeRange)

    Objective-C

    - (void)setTransformRampFromStartTransform:(CGAffineTransform)startTransform toEndTransform:(CGAffineTransform)endTransform timeRange:(CMTimeRange)timeRange

    Parameters

    startTransform

    The transform to be applied at the starting time of timeRange.

    endTransform

    The transform to be applied at the end time of timeRange.

    timeRange

    The time range over which the value of the transform is interpolated between startTransform and endTransform.

    Discussion

    During a transform ramp, the affine transform is interpolated between the values set at the ramp's start time and end time. Before the first specified time for which a transform is set, the affine transform is held constant at the value of CGAffineTransformIdentity; after the last time for which a transform is set, the affine transform is held constant at that last value.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 4.0 and later.

  • Sets a value of the crop rectangle at a time within the time range of the instruction.

    Declaration

    Swift

    func setCropRectangle(_ cropRectangle: CGRect, atTime time: CMTime)

    Objective-C

    - (void)setCropRectangle:(CGRect)cropRectangle atTime:(CMTime)time

    Parameters

    cropRectangle

    The crop rectangle to be applied at the specified time.

    time

    A time value within the timeRange of the composition instruction.

    Discussion

    The origin of the crop rectangle is the top-left corner of the buffer clean aperture rectangle. The crop rectangle is defined in square pixel space, that is, without taking the pixel aspect ratio into account. Crop rectangles extending outside of the clean aperture, are cropped to the clean aperture.

    Sets a fixed crop rectangle to apply from time until the next time at which a crop rectangle is set; this is the same as setting a flat ramp for that time range.

    Before the first specified time for which a crop rectangle is set, the crop rectangle is held constant to CGRectInfinite and after the last time for which a crop rectangle is set, the crop rectangle is held constant at that last value.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • Sets a crop rectangle ramp to apply during the specified time range.

    Declaration

    Swift

    func setCropRectangleRampFromStartCropRectangle(_ startCropRectangle: CGRect, toEndCropRectangle endCropRectangle: CGRect, timeRange timeRange: CMTimeRange)

    Objective-C

    - (void)setCropRectangleRampFromStartCropRectangle:(CGRect)startCropRectangle toEndCropRectangle:(CGRect)endCropRectangle timeRange:(CMTimeRange)timeRange

    Parameters

    startCropRectangle

    The crop rectangle to be applied at the starting time of the timeRange.

    endCropRectangle

    The crop rectangle to be applied at the end time of the timeRange.

    timeRange

    The time range over which the value of the opacity is interpolated between startCropRectangle and endCropRectangle.

    Discussion

    The origin of the crop rectangle is the top-left corner of the buffer clean aperture rectangle. The crop rectangle is defined in square pixel space, that is, without taking the pixel aspect ratio into account. Crop rectangles extending outside of the clean aperture, are cropped to the clean aperture.

    During a crop rectangle ramp, the rectangle is interpolated between the values set at the ramp's start time and end time. When the starting or ending rectangle is empty, interpolations take into account the origin and size of the empty rectangle.

    Before the first specified time for which a crop rectangle is set, the crop rectangle is held constant to CGRectInfinite and after the last time for which a crop rectangle is set, the crop rectangle is held constant at that last value.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.