Class: AVVideoComposition

NSObject show all


An AVVideoComposition object represents an immutable video composition.

Direct Known Subclasses


Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (Object) animationTool (readonly)

A video composition tool to use with Core Animation in offline rendering. (read-only) 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.


- (CMTime) frameDuration (readonly)

The interval for which the video composition should render composed video frames. (read-only) This property only applies when the composition is enabled.


  • (CMTime)

- (Array) instructions (readonly)

The video composition instructions. (read-only) 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).


- (Float) renderScale (readonly)

The scale at which the video composition should render. (read-only) This value must be 1.0 unless the composition is set on an AVPlayerItem.


- (CGSize) renderSize (readonly)

The size at which the video composition should render. (read-only) This property only applies when the composition is enabled.


Class Method Details

+ (Object) videoCompositionWithPropertiesOfAsset(asset)

Creates and returns a video composition object configured to present the video tracks of the specified asset. 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 frameDuration property is set to a value short enough to accommodate the greatest nominal frame rate value among the asset’s video tracks, as indicated by the nominalFrameRate property 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 renderSize property depends on whether the asset is an AVComposition object. If it is, the value is set to the value of the naturalSize property 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 renderScale property is set to 1.0. The value of the animationTool property is set to nil.


  • asset (AVAsset)

    The asset whose configuration matches the intended use of the video composition.


  • (Object)

    A new video composition object.

Instance Method Details

- (Boolean) isValidForAsset(asset, timeRange:timeRange, validationDelegate:validationDelegate)

Indicates whether the time ranges of the composition’s instructions conform to validation requirements. 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.


  • asset (AVAsset)

    An AVAsset object, 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 nil to skip that validation.

  • timeRange (CMTimeRange)

    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 (Object)

    Indicates an object implementing the AVVideoCompositionValidationHandling protocol to receive detailed information about troublesome portions of a video composition during processing.Pass nil if you don’t want to be informed about details.


  • (Boolean)

    YES if the time ranges of the composition’s instructions conform to validation requirements, otherwise NO.