AVVideoComposition Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AVFoundation.framework |
| Availability | Available in iOS 4.0 and later. |
| Companion guide | |
| Declared in | AVVideoComposition.h |
Overview
An AVVideoComposition object represents an immutable video composition.
The AVFoundation framework also provides a mutable subclass, AVMutableVideoComposition, that you can use to create new videos.
Tasks
Creating a Video Composition Object
Properties
-
frameDurationproperty -
renderSizeproperty -
instructionsproperty -
animationToolproperty -
renderScaleproperty
Validation
Properties
animationTool
A video composition tool to use with Core Animation in offline rendering. (read-only)
Discussion
This attribute may be nil.
You set an animation tool if you are using the composition in conjunction with AVAssetExportSession for offline rendering, rather than with AVPlayer.
Availability
- Available in iOS 4.0 and later.
Declared In
AVVideoComposition.hframeDuration
The interval for which the video composition should render composed video frames. (read-only)
Discussion
This property only applies when the composition is enabled.
Availability
- Available in iOS 4.0 and later.
Declared In
AVVideoComposition.hinstructions
The video composition instructions. (read-only)
Discussion
The array contains of instances of AVVideoCompositionInstruction.
For the first instruction in the array, timeRange.start must be less than or equal to the earliest time for which playback or other processing will be attempted (typically kCMTimeZero). For subsequent instructions, timeRange.start must be equal to the prior instruction's end time. The end time of the last instruction must be greater than or equal to the latest time for which playback or other processing will be attempted (typically be the duration of the asset with which the instance of AVVideoComposition is associated).
Availability
- Available in iOS 4.0 and later.
Declared In
AVVideoComposition.hrenderScale
The scale at which the video composition should render. (read-only)
Discussion
This value must be 1.0 unless the composition is set on an AVPlayerItem.
Availability
- Available in iOS 4.0 and later.
Declared In
AVVideoComposition.hrenderSize
The size at which the video composition should render. (read-only)
Discussion
This property only applies when the composition is enabled.
Availability
- Available in iOS 4.0 and later.
Declared In
AVVideoComposition.hClass Methods
videoCompositionWithPropertiesOfAsset:
Creates and returns a video composition object configured to present the video tracks of the specified asset.
Parameters
- asset
The asset whose configuration matches the intended use of the video composition.
Return Value
A new video composition object.
Discussion
This method creates the video composition object and configures it with the values and instructions suitable for presenting the video tracks of the specified asset. The returned object contains instructions that respect the spatial properties and time ranges of the specified asset’s video tracks. It also configures the object properties in the following way:
The value of the
frameDurationproperty is set to a value short enough to accommodate the greatest nominal frame rate value among the asset’s video tracks, as indicated by thenominalFrameRateproperty of each track. If all of the asset tracks have a nominal frame rate of 0, a frame rate of 30 frames per second is used, with the frame duration set accordingly.The value assigned to the
renderSizeproperty depends on whether the asset is anAVCompositionobject. If it is, the value is set to the value of thenaturalSizeproperty of the composition. If it is not, the value is set to a value that encompasses all of the asset’s video tracks.The value of the
renderScaleproperty is set to1.0.The value of the
animationToolproperty is set tonil.
Availability
- Available in iOS 6.0 and later.
Declared In
AVVideoComposition.hInstance Methods
isValidForAsset:timeRange:validationDelegate:
Indicates whether the time ranges of the composition’s instructions conform to validation requirements.
Parameters
- asset
An
AVAssetobject, if you wish to validate the time ranges of the instructions against the duration of the asset and the track IDs of the layer instructions against the asset’s tracks.Pass
nilto skip that validation.- timeRange
A time range.
Only those instructions with time ranges that overlap with this time range will be validated. To validate all instructions that may be used for playback or other processing, regardless of time range, pass
CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity).- validationDelegate
Indicates an object implementing the
AVVideoCompositionValidationHandlingprotocol to receive detailed information about troublesome portions of a video composition during processing.Pass
nilif you don’t want to be informed about details.
Return Value
YES if the time ranges of the composition’s instructions conform to validation requirements, otherwise NO.
Discussion
In the course of validation, the receiver will invoke its delegate (if there is one) with reference to any trouble spots in the video composition.
This method raises an exception if the delegate modifies the receiver’s array of instructions or the array of layer instructions of any AVVideoCompositionInstruction object contained therein during validation.
Availability
- Available in iOS 5.0 and later.
Declared In
AVVideoComposition.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)