AV Foundation Constants Reference
| Framework | AVFoundation/AVFoundation.h |
| Declared in | AVAnimation.h AVMediaFormat.h AVMetadataFormat.h AVVideoSettings.h |
Overview
This document describes constants defined in the AV Foundation framework not described in individual classes or in domain-specific constants references. See also:
Constants
Media Types
Constants to identify various media types.
NSString *const AVMediaTypeVideo; NSString *const AVMediaTypeAudio; NSString *const AVMediaTypeText; NSString *const AVMediaTypeClosedCaption; NSString *const AVMediaTypeSubtitle; NSString *const AVMediaTypeTimecode; NSString *const AVMediaTypeTimedMetadata; NSString *const AVMediaTypeMetadata; NSString *const AVMediaTypeMuxed;
Constants
AVMediaTypeVideoSpecifies video.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaTypeAudioSpecifies audio.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaTypeTextSpecifies text.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaTypeClosedCaptionSpecifies closed-caption content.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaTypeSubtitleSpecifies subtitles.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaTypeTimecodeSpecifies a time code.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaTypeTimedMetadataSpecifies timed metadata.
Available in iOS 4.0 through iOS 5.1.
Declared in
AVMediaFormat.h.AVMediaTypeMetadataSpecifies metadata.
Available in iOS 6.0 and later.
Declared in
AVMediaFormat.h.AVMediaTypeMuxedSpecifies muxed media.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.
Video Gravity
These string constants define how the video is displayed within a layer’s bounds rectangle.
NSString * const AVLayerVideoGravityResize; NSString * const AVLayerVideoGravityResizeAspect; NSString * const AVLayerVideoGravityResizeAspectFill;
Constants
AVLayerVideoGravityResizeSpecifies that the video should be stretched to fill the layer’s bounds.
Available in iOS 4.0 and later.
Declared in
AVAnimation.h.AVLayerVideoGravityResizeAspectSpecifies that the player should preserve the video’s aspect ratio and fit the video within the layer’s bounds.
Available in iOS 4.0 and later.
Declared in
AVAnimation.h.AVLayerVideoGravityResizeAspectFillSpecifies that the player should preserve the video’s aspect ratio and fill the layer’s bounds.
Available in iOS 4.0 and later.
Declared in
AVAnimation.h.
Discussion
You use these constants when setting the videoGravity property of an AVPlayerLayer or AVCaptureVideoPreviewLayer instance.
Media Characteristics
Constants to specify the characteristics of media types.
NSString *const AVMediaCharacteristicVisual; NSString *const AVMediaCharacteristicAudible; NSString *const AVMediaCharacteristicLegible; NSString *const AVMediaCharacteristicFrameBased;
Constants
AVMediaCharacteristicVisualIndicates that the media is visual.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicAudibleIndicates that the media is audible.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicLegibleIndicates that the media is legible.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicFrameBasedIndicates that the media is frame-based.
Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.
Video Settings
These constants define dictionary keys for configuring video compression and compression settings for video assets.
NSString *const AVVideoCodecKey; NSString *const AVVideoCodecH264; NSString *const AVVideoCodecJPEG; NSString *const AVVideoWidthKey; NSString *const AVVideoHeightKey; NSString *const AVVideoCompressionPropertiesKey; NSString *const AVVideoAverageBitRateKey; NSString *const AVVideoQualityKey; NSString *const AVVideoMaxKeyFrameIntervalKey; NSString *const AVVideoProfileLevelKey; NSString *const AVVideoProfileLevelH264Baseline30; NSString *const AVVideoProfileLevelH264Baseline31; NSString *const AVVideoProfileLevelH264Baseline41; NSString *const AVVideoProfileLevelH264Main30; NSString *const AVVideoProfileLevelH264Main31; NSString *const AVVideoProfileLevelH264Main32; NSString *const AVVideoProfileLevelH264Main41; NSString *const AVVideoProfileLevelH264High40; NSString *const AVVideoProfileLevelH264High41; NSString *const AVVideoPixelAspectRatioKey; NSString *const AVVideoPixelAspectRatioHorizontalSpacingKey; NSString *const AVVideoPixelAspectRatioVerticalSpacingKey; NSString *const AVVideoCleanApertureKey; NSString *const AVVideoCleanApertureWidthKey; NSString *const AVVideoCleanApertureHeightKey; NSString *const AVVideoCleanApertureHorizontalOffsetKey; NSString *const AVVideoCleanApertureVerticalOffsetKey;
Constants
AVVideoCodecKeySpecifies a key to access the name of the codec used to encode the video.
The corresponding value is an instance of
NSString; equivalent toCMVideoCodecType.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCodecH264Specifies that the video was encoded using H264.
Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCodecJPEGSpecifies that the video was encoded using the JPEG encoder.
Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoWidthKeySpecifies a key to access the width of the video in pixels.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoHeightKeySpecifies a key to access the height of the video in pixels.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCompressionPropertiesKeySpecifies a key to access the compression properties.
The corresponding value is an instance of
NSDictionary.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoAverageBitRateKeySpecifies a key to access the average bit rate (as bits per second) used in encoding.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoQualityKeySpecifies a key to access the JPEG coded quality.
The corresponding value is an instance of
NSNumber0.0-1.0.Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoMaxKeyFrameIntervalKeySpecifies a key to access the maximum interval between key frames.
The corresponding value is an instance of
NSNumber.1means key frames only.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelKeySpecifies a key to access the video profile.
Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264Baseline30Specifies a baseline level 3.0 profile.
Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264Baseline31Specifies a baseline level 3.1 profile.
Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264Baseline41Specifies a baseline level 4.1 profile.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264Main30Specifies a main level 3.0 profile.
Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264Main31Specifies a main level 3.1 profile.
Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264Main32Specifies a main level 3.2 profile.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264Main41Specifies a main level 4.1 profile.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264High40Specifies a high level 4.0 profile.
Available in iOS 6.0 and later.
Declared in
AVVideoSettings.h.AVVideoProfileLevelH264High41Specifies a high level 4.1 profile.
Available in iOS 6.0 and later.
Declared in
AVVideoSettings.h.AVVideoPixelAspectRatioKeySpecifies a key to access the pixel aspect ratio.
The corresponding value is an instance of
NSDictionary.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoPixelAspectRatioHorizontalSpacingKeySpecifies a key to access the pixel aspect ratio horizontal spacing.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoPixelAspectRatioVerticalSpacingKeySpecifies a key to access the pixel aspect ratio vertical spacing.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCleanApertureKeySpecifies a key to access the clean aperture.
The corresponding value is an instance of
NSDictionary.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCleanApertureWidthKeySpecifies a key to access the clean aperture width.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCleanApertureHeightKeySpecifies a key to access the clean aperture height.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCleanApertureHorizontalOffsetKeySpecifies a key to access the clean aperture horizontal offset.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.AVVideoCleanApertureVerticalOffsetKeySpecifies a key to access the clean aperture vertical offset.
The corresponding value is an instance of
NSNumber.Available in iOS 4.0 and later.
Declared in
AVVideoSettings.h.
File Format UTIs
These constants specify UTIs for various file formats.
NSString *const AVFileType3GPP; NSString *const AVFileTypeAIFC; NSString *const AVFileTypeAIFF; NSString *const AVFileTypeAMR; NSString *const AVFileTypeCoreAudioFormat; NSString *const AVFileTypeAppleM4V; NSString *const AVFileTypeMPEG4; NSString *const AVFileTypeAppleM4A; NSString *const AVFileTypeQuickTimeMovie; NSString *const AVFileTypeWAVE;
Constants
AVFileType3GPPUTI for the 3GPP file format.
The value of this UTI is
public.3gpp. Files are identified with the .3gp, .3gpp, and .sdv extensions.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeAIFCUTI for the AIFC audio file format.
The value of this UTI is
public.aifc-audio. Files are identified with the .aifc and .cdda extensions.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeAIFFUTI for the AIFF audio file format.
The value of this UTI is
public.aiff-audio. Files are identified with the .aif and .aiff extensions.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeCoreAudioFormatUTI for the CoreAudio file format.
The value of this UTI is
com.apple.coreaudio-format. Files are identified with the .caf extension.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeAppleM4VUTI for the iTunes video file format.
The value of this UTI is
com.apple.mpeg-4-video. Files are identified with the .m4v extension.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeMPEG4UTI for the MPEG-4 file format.
The value of this UTI is
public.mpeg-4. Files are identified with the .mp4 extension.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeAppleM4AUTI for the Apple m4a audio file format.
The value of this UTI is
com.apple.m4a-audio. Files are identified with the .m4a extension.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeQuickTimeMovieUTI for the QuickTime movie file format.
The value of this UTI is
com.apple.quicktime-movie. Files are identified with the .mov and .qt extensions.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeWAVEA UTI for the WAVE audio file format.
The value of this UTI is
com.microsoft.waveform-audio. Files are identified with the .wav, .wave, and .bwf extensions.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.AVFileTypeAMRUTI for the adaptive multi-rate audio file format.
The value of this UTI is
org.3gpp.adaptive-multi-rate-audio. Files are identified with the .amr extension.Available in iOS 4.0 and later.
Declared in
AVMediaFormat.h.
Core Animation
Support for integration with Core Animation.
const CFTimeInterval AVCoreAnimationBeginTimeAtZero
Constants
AVCoreAnimationBeginTimeAtZeroUse this constant to set the CoreAnimation's animation
beginTimeproperty to be time0.The constant is a small, non-zero, positive value which prevents CoreAnimation from replacing
0.0withCACurrentMediaTime.Available in iOS 4.0 and later.
Declared in
AVAnimation.h.
Video Scaling Mode
Constants to specify how video should be scaled to fit a given area.
NSString *const AVVideoScalingModeKey; NSString *const AVVideoScalingModeFit; NSString *const AVVideoScalingModeResize; NSString *const AVVideoScalingModeResizeAspect; NSString *const AVVideoScalingModeResizeAspectFill;
Constants
AVVideoScalingModeKeyA key to retrieve the video scaling mode from a dictionary.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoScalingModeFitCrop to remove edge processing region; preserve aspect ratio of cropped source by reducing specified width or height if necessary.
This mode does not scale a small source up to larger dimensions.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoScalingModeResizeCrop to remove edge processing region; scale remainder to destination area.
This mode does not preserve the aspect ratio.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoScalingModeResizeAspectPreserve aspect ratio of the source, and fill remaining areas with black to fit destination dimensions.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.AVVideoScalingModeResizeAspectFillPreserve aspect ratio of the source, and crop picture to fit destination dimensions.
Available in iOS 5.0 and later.
Declared in
AVVideoSettings.h.
Metadata Keys
Common metadata and common keys for metadata.
NSString *const AVMetadataKeySpaceCommon; NSString *const AVMetadataCommonKeyTitle; NSString *const AVMetadataCommonKeyCreator; NSString *const AVMetadataCommonKeySubject; NSString *const AVMetadataCommonKeyDescription; NSString *const AVMetadataCommonKeyPublisher; NSString *const AVMetadataCommonKeyContributor; NSString *const AVMetadataCommonKeyCreationDate; NSString *const AVMetadataCommonKeyLastModifiedDate; NSString *const AVMetadataCommonKeyType; NSString *const AVMetadataCommonKeyFormat; NSString *const AVMetadataCommonKeyIdentifier; NSString *const AVMetadataCommonKeySource; NSString *const AVMetadataCommonKeyLanguage; NSString *const AVMetadataCommonKeyRelation; NSString *const AVMetadataCommonKeyLocation; NSString *const AVMetadataCommonKeyCopyrights; NSString *const AVMetadataCommonKeyAlbumName; NSString *const AVMetadataCommonKeyAuthor; NSString *const AVMetadataCommonKeyArtist; NSString *const AVMetadataCommonKeyArtwork; NSString *const AVMetadataCommonKeyMake; NSString *const AVMetadataCommonKeyModel; NSString *const AVMetadataCommonKeySoftware;
Constants
AVMetadataKeySpaceCommonAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyTitleAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyCreatorAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeySubjectAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyDescriptionAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyPublisherAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyContributorAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyCreationDateAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyLastModifiedDateAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyTypeAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyFormatAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyIdentifierAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeySourceAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyLanguageAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyRelationAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyLocationAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyCopyrightsAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyAlbumNameAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyAuthorAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyArtistAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyArtworkAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyMakeAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeyModelAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.AVMetadataCommonKeySoftwareAvailable in iOS 4.0 and later.
Declared in
AVMetadataFormat.h.
AVMediaSelectionOption Constants
Media characteristic that may be present in an AVMediaSelectionOption object.
NSString *const AVMediaCharacteristicIsMainProgramContent; NSString *const AVMediaCharacteristicIsAuxiliaryContent; NSString *const AVMediaCharacteristicContainsOnlyForcedSubtitles; NSString *const AVMediaCharacteristicTranscribesSpokenDialogForAccessibility; NSString *const AVMediaCharacteristicDescribesMusicAndSoundForAccessibility; NSString *const AVMediaCharacteristicDescribesVideoForAccessibility; NSString *const AVMediaCharacteristicEasyToRead;
Constants
AVMediaCharacteristicIsMainProgramContentIndicates that the option includes content that’s marked by the content author as intrinsic to the presentation of the asset.
Example: an option that presents the main program audio for the presentation, regardless of locale, would typically have this characteristic.
The value of this characteristic is
"public.main-program-content".The presence of this characteristic for a media option is inferred; any option that does not have the characteristic
AVMediaCharacteristicIsAuxiliaryContentis considered to have the characteristic.Available in iOS 5.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicIsAuxiliaryContentIndicates that the option includes content that’s marked by the content author as auxiliary to the presentation of the asset.
Example: an option that presents audio media containing commentary on the presentation would typically have this characteristic.
The value of this characteristic is
"public.auxiliary-content".For QuickTime movie and .m4v files, a media option is considered to have the characteristic
AVMediaCharacteristicIsAuxiliaryContentif it’s explicitly tagged with that characteristic or if, as a member of an alternate track group, its associated track is excluded from autoselection.Available in iOS 5.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicContainsOnlyForcedSubtitlesIndicates that the options presents only forced subtitles.
Media options with forced-only subtitles are typically selected when 1) the user has not selected a legible option with an accessibility characteristic or an auxiliary purpose and 2) its locale matches the locale of the selected audible media selection option.
The value of this characteristic is
"public.subtitles.forced-only".The presence of this characteristic for a legible media option is inferred from the format description of the associated track that presents the subtitle media.
Available in iOS 5.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicTranscribesSpokenDialogForAccessibilityIndicates that the option includes legible content in the language of its specified locale that transcribes spoken dialog.
It is possible for a legible media option to include both transcriptions of spoken dialog and descriptions of music and sound effects.
The value of this characteristic is
"public.accessibility.transcribes-spoken-dialog".For QuickTime movie and .m4v files, a media option is considered to have the characteristic
AVMediaCharacteristicTranscribesSpokenDialogForAccessibilityonly if it’s explicitly tagged with that characteristic.Available in iOS 5.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicDescribesMusicAndSoundForAccessibilityIndicates that the option includes legible content in the language of its specified locale that describes music and sound effects occurring in program audio.
It is possible for a legible media option to include both transcriptions of spoken dialog and descriptions of music and sound effects.
The value of this characteristic is
"public.accessibility.describes-music-and-sound".For QuickTime movie and .m4v files, a media option is considered to have the characteristic
AVMediaCharacteristicDescribesMusicAndSoundForAccessibilityonly if it’s explicitly tagged with that characteristic.Available in iOS 5.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicDescribesVideoForAccessibilityIndicates that the option includes audible content that describes the visual portion of the presentation.
It is possible for a legible media option to include both transcriptions of spoken dialog and descriptions of music and sound effects.
The value of this characteristic is
"public.accessibility.describes-video".For QuickTime movie and .m4v files a media option is considered to have the characteristic
AVMediaCharacteristicEasyToReadonly if it’s explicitly tagged with that characteristic.Available in iOS 5.0 and later.
Declared in
AVMediaFormat.h.AVMediaCharacteristicEasyToReadIndicates that the option provides legible content in the language of its specified locale and that the content has been edited for ease of reading.
Closed caption tracks that carry "easy reader" captions (per the CEA-608 specification) should be tagged with this characteristic. Subtitle tracks can also be tagged with this characteristic, where appropriate.
The value of this characteristic is
"public.easy-to-read".For QuickTime movie and .m4v files a media option is considered to have the characteristic
AVMediaCharacteristicEasyToReadonly if it’s explicitly tagged with that characteristic.Available in iOS 6.0 and later.
Declared in
AVMediaFormat.h.
Discussion
Each track of .mov files and .m4v files (that is, files of type AVFileTypeQuickTimeMovie and AVFileTypeAppleM4V) can optionally carry one or more tagged media characteristics, each of which declares a purpose, a trait, or some other distinguishing property of the track's media.
For example, a track containing audio that mixes original program content with additional narrative descriptions of visual action may be tagged with the media characteristic "public.accessibility.describes-video" in order to distinguish it from other audio tracks stored in the same file that do not contain additional narrative.
Each tagged media characteristic in .mov and .m4v files is stored in track userdata as a userdata item of type 'tagc' (represented as a FourCharCode) that consists of a standard atom header (size and type) followed by an array of US-ASCII characters (8-bit, high bit clear) comprising the value of the tag. The character array is not a C string; there is no terminating zero. The userdata item atom size is sum of the standard atom header size (8) and the size of the US-ASCII character array.
You can inspect the tagged media characteristics of a track as follows:
NSArray *trackUserDataItems = [myAVAssetTrack metadataForFormat:AVMetadataFormatQuickTimeUserData]; |
NSArray *trackTaggedMediaCharacteristics = [AVMetadataItem metadataItemsFromArray:trackUserDataItems |
withKey:AVMetadataQuickTimeUserDataKeyTaggedCharacteristic |
keySpace:AVMetadataKeySpaceQuickTimeUserData]; |
for (AVMetadataItem *metadataItem in trackTaggedMediaCharacteristics) { |
NSString *thisTrackMediaCharacteristic = [metadataItem stringValue]; |
} |
You can use hasMediaCharacteristic:] to determine whether a track has a particular media characteristic, whether the characteristic is inferred from its media type or format descriptions (such as AVMediaCharacteristicAudible or AVMediaCharacteristicContainsOnlyForcedSubtitles) or requires explicit tagging (such as AVMediaCharacteristicTranscribesSpokenDialogForAccessibility or AVMediaCharacteristicEasyToRead). Note that explicit tagging can’t be used to override inferences from tracks' media types or format descriptions; for example:
[anAVAssetTrack hasMediaCharacteristic:AVMediaCharacteristicVisual] |
will return NO for any audio track, even if the track has been perversely tagged with the visual characteristic.
Tagged media characteristics can be written to the QuickTime userdata of an output track associated with an AVAssetWriterInput objectas follows, provided that the output file type of the asset writer is either AVFileTypeQuickTimeMovie or AVFileTypeAppleM4V:
AVMutableMetadataItem *myTaggedMediaCharacteristic = [[AVMutableMetadataItem alloc] init]; |
[myTaggedMediaCharacteristic setKey:AVMetadataQuickTimeUserDataKeyTaggedCharacteristic]; |
[myTaggedMediaCharacteristic setKeySpace:AVMetadataKeySpaceQuickTimeUserData]; |
[myTaggedMediaCharacteristic setValue:aMeaningfulCharacteristicAsNSString]; |
[myMutableArrayOfMetadata addObject:myTaggedMediaCharacteristic]; |
[myAssetWriterInput setMetadata:myMutableArrayOfMetadata]; |
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)