AVVideoCompositionCoreAnimationTool Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 4.0 and later.
Declared in
AVVideoComposition.h
Related sample code

Overview

You use an AVVideoCompositionCoreAnimationTool object to incorporate Core Animation in a video composition.

Any animations will be interpreted on the video's timeline, not real-time, so you should:

  1. Set animations’ beginTime property to AVCoreAnimationBeginTimeAtZero rather than 0 (which CoreAnimation replaces with CACurrentMediaTime);

  2. Set removedOnCompletion to NO on animations so they are not automatically removed;

  3. Avoid using layers that are associated with UIView objects.

Tasks

Creating a Composition Tool

Class Methods

videoCompositionCoreAnimationToolWithAdditionalLayer:asTrackID:

Add a Core Animation layer to the video composition.

+ (AVVideoCompositionCoreAnimationTool *)videoCompositionCoreAnimationToolWithAdditionalLayer:(CALayer *)layer asTrackID:(CMPersistentTrackID)trackID
Parameters
layer

The Core Animation layer to add.

trackID

A track ID to identify the track.

trackID should not match any real trackID in the source.

Return Value

A new Core Animation tool for the layer.

Discussion

You use this method to include a Core Animation layer as an individual track input in video composition.

Video composition instructions should reference trackID where the rendered animation should be included.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVVideoComposition.h

videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:inLayer:

Composes the composited video frame with a Core Animation layer.

+ (AVVideoCompositionCoreAnimationTool *)videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:(CALayer *)videoLayer inLayer:(CALayer *)animationLayer
Parameters
videoLayer

A video layer.

animationLayer

An animation layer.

Return Value

A new animation tool for the composition.

Discussion

Place composited video frames in videoLayer and render animationLayer to produce the final frame.

The videoLayer should be in the animationLayer sublayer tree. The animationLayer should not come from, or be added to, another layer tree.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
AVVideoComposition.h

videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayers:inLayer:

Composes the composited video frames with the Core Animation layer.

+ (AVVideoCompositionCoreAnimationTool *)videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayers:(NSArray *)videoLayers inLayer:(CALayer *)animationLayer
Parameters
videoLayers

An array containing the video layers

animationLayer

The animation layer.

Return Value

A new AVVideoCompositionCoreAnimationTool instance with the composited video frames and the rendered animation layer.

Discussion

Duplicates the composited video frames in each videoLayer and renders animationLayer to produce the final frame. The videoLayers should be in animationLayer's sublayer tree.

The animationLayer should not come from, or be added to, another layer tree.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVVideoComposition.h