Class: AVAssetExportSession
Overview
An AVAssetExportSession object transcodes the contents of an AVAsset source object to create an output of the form described by a specified export preset.
Instance Attribute Summary (collapse)
-
- asset
readonly
The asset with which the export session was initialized.
-
- audioMix
Indicates whether non-default audio mixing is enabled for export, and supplies the parameters for audio mixing.
-
- error
readonly
Describes the error that occurred if the export status is AVAssetExportSessionStatusFailed or AVAssetExportSessionStatusCancelled.
-
- estimatedOutputFileLength
readonly
Indicates the estimated size in bytes of the exported file.
-
- fileLengthLimit
The maximum number of bytes that the session is allowed to write to the output URL.
-
- maxDuration
readonly
The maximum duration that is allowed for export.
-
- metadata
The metadata to be written to the output file by the export session.
-
- outputFileType
The type of file to be written by the session.
-
- outputURL
The URL of the export session’s output.
-
- presetName
readonly
The name of the preset with which the session was initialized.
-
- progress
readonly
The progress of the export on a scale from 0 to 1.
-
- shouldOptimizeForNetworkUse
Indicates whether the movie should be optimized for network use.
-
- status
readonly
The status of the export session.
-
- supportedFileTypes
readonly
The types of files the session can write.
-
- timeRange
The time range to be exported from the source.
-
- videoComposition
Indicates whether video composition is enabled for export, and supplies the instructions for video composition.
Class Method Summary (collapse)
-
+ allExportPresets
Returns all available export preset names.
-
+ determineCompatibilityOfExportPreset:withAsset:outputFileType:completionHandler:
Reports the compatibility of an export present, asset, and output file type to the specified block.
-
+ exportPresetsCompatibleWithAsset:
Returns the identifiers compatible with a given asset.
-
+ exportSessionWithAsset:presetName:
Returns an asset export session configured with a specified asset and preset.
Instance Method Summary (collapse)
-
- cancelExport
Cancels the execution of an export session.
-
- determineCompatibleFileTypesWithCompletionHandler:
Reports the compatible file types for the current export session to the specified block.
-
- exportAsynchronouslyWithCompletionHandler:
Starts the asynchronous execution of an export session.
-
- initWithAsset:presetName:
Initializes an asset export session with a specified asset and preset.
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
- (AVAsset) asset (readonly)
The asset with which the export session was initialized. (read-only)
- (AVAudioMix) audioMix
Indicates whether non-default audio mixing is enabled for export, and supplies the parameters for audio mixing. You can observe this property using key-value observing.
- (NSError) error (readonly)
Describes the error that occurred if the export status is AVAssetExportSessionStatusFailed or AVAssetExportSessionStatusCancelled. (read-only) If there is no error to report, the value of this property is nil.
- (Integer) estimatedOutputFileLength (readonly)
Indicates the estimated size in bytes of the exported file. (read-only)
- (Integer) fileLengthLimit
The maximum number of bytes that the session is allowed to write to the output URL. The export will stop when the output reaches this size regardless of the duration of the source or the value of timeRange.You can observe this property using key-value observing.
- (CMTime) maxDuration (readonly)
The maximum duration that is allowed for export. (read-only) You can observe this property using key-value observing.
- (Array) metadata
The metadata to be written to the output file by the export session. The metadata is an array of AVMetadataItem objects.If the value of this key is nil, any existing metadata in the exported asset will be translated as accurately as possible into the appropriate metadata key space for the output file and written to the output.You can observe this property using key-value observing.
- (String) outputFileType
The type of file to be written by the session. The value is a UTI string corresponding to the file type to use when writing the asset. For a list of constants specifying UTIs for standard file types, see AV Foundation Constants Reference.You can observe this property using key-value observing.
- (NSURL) outputURL
The URL of the export session’s output. You can observe this property using key-value observing.
- (String) presetName (readonly)
The name of the preset with which the session was initialized. (read-only) For possible values, see “Export Preset Names for Device-Appropriate QuickTime Files,” “Export Preset Names for QuickTime Files of a Given Size,” AVAssetExportSessionStatusCancelled, “Export Preset Name for iTunes Audio,” and “Export Preset Name for Pass-Through.”You can observe this property using key-value observing.
- (Float) progress (readonly)
The progress of the export on a scale from 0 to 1. (read-only) A value of 0 means the export has not yet begun, 1 means the export is complete.
- (Boolean) shouldOptimizeForNetworkUse
Indicates whether the movie should be optimized for network use. You can observe this property using key-value observing.
- (AVAssetExportSessionStatus) status (readonly)
The status of the export session. (read-only) For possible values, see “AVAssetExportSessionStatus.”You can observe this property using key-value observing.
- (Array) supportedFileTypes (readonly)
The types of files the session can write. (read-only) The types of files the session can write are determined by the asset and and export preset with which the session was initialized. If you need to determine the compatible file formats before initiating the export operation, use the determineCompatibleFileTypesWithCompletionHandler: method.You can observe this property using key-value observing.
- (CMTimeRange) timeRange
The time range to be exported from the source. The default time range of an export session is kCMTimeZero to kCMTimePositiveInfinity, meaning that (modulo a possible limit on file length) the full duration of the asset will be exported.You can observe this property using key-value observing.
- (Object) videoComposition
Indicates whether video composition is enabled for export, and supplies the instructions for video composition. You can observe this property using key-value observing.
Class Method Details
+ (Array) allExportPresets
Returns all available export preset names. Not all presets are compatible with all assets.
+ (Object) determineCompatibilityOfExportPreset(presetName, withAsset:asset, outputFileType:outputFileType, completionHandler:handler)
Reports the compatibility of an export present, asset, and output file type to the specified block. Because not all export presets are compatible with all assets and file types, you can use this method to query the compatibility of specific combos before using them. To ensure that the export operation succeeds, you should not make any significant changes to the asset between the time of calling this method and performing the export operation. This method performs its checks asynchronously on a secondary thread and returns immediately. The results are similarly reported to the specified block on a secondary thread.
+ (Array) exportPresetsCompatibleWithAsset(asset)
Returns the identifiers compatible with a given asset. Not all export presets are compatible with all assets. For example, a video-only asset is not compatible with an audio-only preset. This method returns only the identifiers for presets that are compatible with the given asset. In order to ensure that the setup and running of an export operation will succeed using a given preset, you should not make significant changes to the asset (such as adding or deleting tracks) between retrieving compatible identifiers and performing the export operation.If the asset’s tracks are not currently loaded, they may be loaded by this method before any checks are performed.
+ (Object) exportSessionWithAsset(asset, presetName:presetName)
Returns an asset export session configured with a specified asset and preset.
Instance Method Details
- (Object) cancelExport
Cancels the execution of an export session. You can invoke this method when the export is running.
- (Object) determineCompatibleFileTypesWithCompletionHandler(handler)
Reports the compatible file types for the current export session to the specified block. This method operates on the asset object and preset information that was used to initialize the export session. It uses this information to determine the file types that the export session can write. This method performs its checks asynchronously on a secondary thread and returns immediately. The results are similarly reported to the specified block on a secondary thread. Because this method actually inspects the asset’s tracks, the tracks are loaded if they have not been already.
- (Object) exportAsynchronouslyWithCompletionHandler(handler)
Starts the asynchronous execution of an export session. This method starts an asynchronous export operation and returns immediately. status signals the terminal state of the export session, and if a failure occurs, error describes the problem.If internal preparation for export fails, handler is invoked synchronously. The handler may also be called asynchronously, after the method returns, in the following cases:If a failure occurs during the export, including failures of loading, re-encoding, or writing media data to the output.If cancelExport is invoked.After the export session succeeds, having completely written its output to the outputURL.
- (Object) initWithAsset(asset, presetName:presetName)
Initializes an asset export session with a specified asset and preset.