Class

AVAssetExportSession

An object that transcodes the contents of an asset source object to create an output of the form described by a specified export preset.

Declaration

@interface AVAssetExportSession : NSObject

Overview

Prior to initializing an instance of AVAssetExportSession, you can use allExportPresets to get the complete list of presets available. Use exportPresetsCompatibleWithAsset: to get a list of presets that are compatible with a specific asset.

After you have initialized an export session with the asset that contains the source media, the export preset name (presetName), and the output file type (outputFileType), you can start the export running by invoking exportAsynchronouslyWithCompletionHandler:. Because the export is performed asynchronously, this method returns immediately—you can use progress to check on the progress. Depending on the capabilities of the device, some exports may be queued when multiple exports are attempted. When this happens, the status of a queued export will indicate that it's waiting (AVAssetExportSessionStatusWaiting).

The completion handler you supply to exportAsynchronouslyWithCompletionHandler: is called whether the export fails, completes, or is cancelled. Upon completion, the status property indicates whether the export has completed successfully. If it has failed, the value of the error property supplies additional information about the reason for the failure.

Topics

Initializing a Session

- initWithAsset:presetName:

Creates an asset export session with a specified asset and preset.

+ exportSessionWithAsset:presetName:

Returns an asset export session configured with a specified asset and preset.

Configuring Output

outputURL

The URL of the export session’s output.

supportedFileTypes

An array containing the types of files the session can write.

outputFileType

The type of file written by the session.

fileLengthLimit

The file length that the output of the session should not exceed.

timeRange

The time range exported from the source.

metadata

The metadata written to the output file by the export session.

metadataItemFilter

Specifies a filter object used during export to determine which metadata items to transfer from the source asset.

audioMix

The parameters for audio mixing and an indication whether to enable nondefault audio mixing for export.

audioTimePitchAlgorithm

A processing algorithm used to manage audio pitch for scaled audio edits.

shouldOptimizeForNetworkUse

A Boolean value that indicates whether to optimize the movie should for network use.

videoComposition

The instructions for video composition, and indicates whether video composition is enabled for export.

customVideoCompositor

The custom video compositor instance used, if any.

canPerformMultiplePassesOverSourceMediaData

A Boolean value that indicates whether the export session can perform multiple passes over the source media to achieve better results.

directoryForTemporaryFiles

A directory that is suitable for containing temporary files generated during the export process.

Configuring Export Presets

presetName

The name of the preset used to initialize the session.

+ allExportPresets

Returns all available export preset names.

+ exportPresetsCompatibleWithAsset:

Returns the identifiers compatible with a given asset.

+ determineCompatibilityOfExportPreset:withAsset:outputFileType:completionHandler:

Reports the compatibility of an export present, asset, and output file type to the specified block.

Export Preset Names for Device-Appropriate QuickTime Files

You use these export options to produce QuickTime movie files with video size appropriate to the current device.

Export Preset Names for QuickTime Files of a Given Size

You use these export options to produce QuickTime movie files with a specified video size.

Export Preset Name for iTunes Audio

You use this export option to produce an audio-only MPEG 4 Audio file with appropriate iTunes gapless playback data.

Export Preset Names for Apple Devices

You use these export options to produce playable files for use on specific Apple devices.

Export Preset Name for Pass Through

You use this export option to let all tracks pass through as formatted unless otherwise prohibited.

- determineCompatibleFileTypesWithCompletionHandler:

Reports the compatible file types for the current export session to the specified block.

Exporting Media

- exportAsynchronouslyWithCompletionHandler:

Starts the asynchronous execution of an export session.

- cancelExport

Cancels the execution of an export session.

error

Describes the error that occurred.

AVAssetExportSessionStatus

A set of statuses used for relaying the state of an export session.

estimatedOutputFileLength

The estimated size, in bytes, of the exported file.

maxDuration

Provides an estimate of the maximum duration of the exported media.

Getting Export Status

progress

The progress of the export on a scale from 0 to 1.

status

The status of the export session.

Accessing the Asset

asset

The asset used to initialize the export session.

Relationships

Inherits From

See Also

File Export

Exporting Video to Alternative Formats

Convert an existing movie file to a different format.

AVAssetWriter

An object used to write media data to a new file of a specified audiovisual container type.

AVAssetWriterInput

A writer used to append media samples to a single track of an asset writer's output file.

AVVideoTransferFunction_ITU_R_2100_HLG

The transfer function for the ITU_R BT.2100 color space.

AVOutputSettingsAssistant

An object that specifies a set of parameters for configuring objects that use output settings dictionaries.

AVAssetWriterInputGroup

A group of tracks in a mutually exclusive relationship.

AVAssetWriterInputMetadataAdaptor

An object that defines an interface for writing metadata packaged as timed metadata groups into a single asset writer input.

AVAssetWriterInputPassDescription

An object that defines an interface for querying about the requirements of the current pass.

AVAssetWriterInputPixelBufferAdaptor

A buffer used to append video samples packaged as pixel buffers to a single asset writer input.