AVAssetWriterInputGroup Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 7.0 and later.
Declared in
AVAssetWriter.h

Overview

The AVAssetWriterInputGroup class associates tracks corresponding to inputs with each other in a mutually exclusive relationship.

This class is used to associate tracks corresponding to multiple AVAssetWriterInput instances as mutually exclusive to each other for playback or other processing.

For example, if you are creating an asset with multiple audio tracks using different spoken languages–and only one track should be played at a time–group the inputs corresponding to those tracks into a single instance of AVAssetWriterInputGroup and add the group to the AVAssetWriter instance using the AVAssetWriter method addInputGroup:. If the output format supports mutually exclusive relationships among tracks, the AVAssetWriter marks the tracks as mutually exclusive to each other.

Because the AVAssetWriterInputGroup class is a subclass of the AVMediaSelectionGroup class, clients can examine the media selection options that are available on the output asset before the asset is written. The best results for examining the options of the AVAssetWriterInputGroup are obtained after associating the AVAssetWriterInput instances of the AVAssetTrack objects as appropriate using the AVAssetWriterInput method addTrackAssociationWithTrackOfInput:type: and by initializing each AVAssetWriterInput with a source format hint, where appropriate.

Tasks

Creating an Asset Writer Input Group

Getting the Asset Writer Input Group Settings

Properties

defaultInput

The the default input object. (read-only)

@property(nonatomic, readonly) AVAssetWriterInput *defaultInput
Availability
  • Available in iOS 7.0 and later.
Declared In
AVAssetWriter.h

inputs

The the inputs array. (read-only)

@property(nonatomic, readonly) NSArray *inputs
Availability
  • Available in iOS 7.0 and later.
Declared In
AVAssetWriter.h

Class Methods

assetWriterInputGroupWithInputs:defaultInput:

Creates and initializes an instance of an asset writer input group.

+ (AVAssetWriterInputGroup *)assetWriterInputGroupWithInputs:(NSArray *)inputs defaultInput:(AVAssetWriterInput *)defaultInput
Parameters
inputs

An array of AVAssetWriterInput instances to be grouped together.

defaultInput

The instance of AVAssetWriterInput to designate as the default input for the group.

Return Value

An initialized instance of AVAssetWriterInputGroup.

Discussion

When the input group is added to an AVAssetWriter instance using the addInputGroup: method, the AVAssetWriterInput property marksOutputTrackAsEnabled is automatically set to YES for defaultInput and NO for all of the other inputs in the group.

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

Instance Methods

initWithInputs:defaultInput:

Initializes an instance of an asset writer input group.

- (id)initWithInputs:(NSArray *)inputs defaultInput:(AVAssetWriterInput *)defaultInput
Parameters
inputs

An array of AVAssetWriterInput instances to be grouped together.

defaultInput

The instance of AVAssetWriterInput to designate as the default input for the group.

Return Value

An initialized instance of AVAssetWriterInputGroup.

Discussion

When the input group is added to an AVAssetWriter instance using the addInputGroup: method, the AVAssetWriterInput property marksOutputTrackAsEnabled is automatically set to YES for defaultInput and NO for all of the other inputs in the group.

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