AV Foundation Constants Reference

Framework
AVFoundation/AVFoundation.h
Declared in
AVAnimation.h
AVMediaFormat.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
AVMediaTypeVideo

Specifies video.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaTypeAudio

Specifies audio.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaTypeText

Specifies text.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaTypeClosedCaption

Specifies closed-caption content.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaTypeSubtitle

Specifies subtitles.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaTypeTimecode

Specifies a time code.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaTypeTimedMetadata

Specifies timed metadata.

Available in iOS 4.0 through iOS 5.1.

Declared in AVMediaFormat.h.

AVMediaTypeMetadata

Specifies metadata.

Available in iOS 6.0 and later.

Declared in AVMediaFormat.h.

AVMediaTypeMuxed

Specifies 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
AVLayerVideoGravityResize

Specifies that the video should be stretched to fill the layer’s bounds.

Available in iOS 4.0 and later.

Declared in AVAnimation.h.

AVLayerVideoGravityResizeAspect

Specifies 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.

AVLayerVideoGravityResizeAspectFill

Specifies 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
AVMediaCharacteristicVisual

Indicates that the media is visual.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaCharacteristicAudible

Indicates that the media is audible.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaCharacteristicLegible

Indicates that the media is legible.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVMediaCharacteristicFrameBased

Indicates 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
AVVideoCodecKey

Specifies a key to access the name of the codec used to encode the video.

The corresponding value is an instance of NSString; equivalent to CMVideoCodecType.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoCodecH264

Specifies that the video was encoded using H264.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoCodecJPEG

Specifies that the video was encoded using the JPEG encoder.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoWidthKey

Specifies 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.

AVVideoHeightKey

Specifies 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.

AVVideoCompressionPropertiesKey

Specifies 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.

AVVideoAverageBitRateKey

Specifies 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.

AVVideoQualityKey

Specifies a key to access the JPEG coded quality.

The corresponding value is an instance of NSNumber 0.0-1.0.

Available in iOS 5.0 and later.

Declared in AVVideoSettings.h.

AVVideoMaxKeyFrameIntervalKey

Specifies a key to access the maximum interval between key frames.

The corresponding value is an instance of NSNumber. 1 means key frames only.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelKey

Specifies a key to access the video profile.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264Baseline30

Specifies a baseline level 3.0 profile.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264Baseline31

Specifies a baseline level 3.1 profile.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264Baseline41

Specifies a baseline level 4.1 profile.

Available in iOS 5.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264Main30

Specifies a main level 3.0 profile.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264Main31

Specifies a main level 3.1 profile.

Available in iOS 4.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264Main32

Specifies a main level 3.2 profile.

Available in iOS 5.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264Main41

Specifies a main level 4.1 profile.

Available in iOS 5.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264High40

Specifies a high level 4.0 profile.

Available in iOS 6.0 and later.

Declared in AVVideoSettings.h.

AVVideoProfileLevelH264High41

Specifies a high level 4.1 profile.

Available in iOS 6.0 and later.

Declared in AVVideoSettings.h.

AVVideoPixelAspectRatioKey

Specifies 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.

AVVideoPixelAspectRatioHorizontalSpacingKey

Specifies 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.

AVVideoPixelAspectRatioVerticalSpacingKey

Specifies 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.

AVVideoCleanApertureKey

Specifies 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.

AVVideoCleanApertureWidthKey

Specifies 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.

AVVideoCleanApertureHeightKey

Specifies 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.

AVVideoCleanApertureHorizontalOffsetKey

Specifies 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.

AVVideoCleanApertureVerticalOffsetKey

Specifies 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 AVFileType3GPP2;
NSString *const AVFileTypeAIFC;
NSString *const AVFileTypeAIFF;
NSString *const AVFileTypeAMR;
NSString *const AVFileTypeAC3;
NSString *const AVFileTypeMPEGLayer3;
NSString *const AVFileTypeSunAU;
NSString *const AVFileTypeCoreAudioFormat;
NSString *const AVFileTypeAppleM4V;
NSString *const AVFileTypeMPEG4;
NSString *const AVFileTypeAppleM4A;
NSString *const AVFileTypeQuickTimeMovie;
NSString *const AVFileTypeWAVE;
Constants
AVFileType3GPP

UTI 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.

AVFileType3GPP2

UTI for the 3GPP2 file format.

The value of this UTI is public.3gpp2. Files are identified with the .3g2, .3gp2 extensions.

Available in iOS 7.0 and later.

Declared in AVMediaFormat.h.

AVFileTypeAIFC

UTI 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.

AVFileTypeAIFF

UTI 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.

AVFileTypeCoreAudioFormat

UTI 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.

AVFileTypeAppleM4V

UTI for the iTunes video file format.

The value of this UTI is com.apple.m4v-video. Files are identified with the .m4v extension.

Available in iOS 4.0 and later.

Declared in AVMediaFormat.h.

AVFileTypeMPEG4

UTI 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.

AVFileTypeAppleM4A

UTI 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.

AVFileTypeQuickTimeMovie

UTI 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.

AVFileTypeWAVE

A 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.

AVFileTypeAMR

UTI 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.

AVFileTypeAC3

UTI for the AC-3 audio file format.

The value of this UTI is public.ac3-audio. Files are identified with the .ac3 extension.

Available in iOS 7.0 and later.

Declared in AVMediaFormat.h.

AVFileTypeMPEGLayer3

UTI for the MPEG layer 3 audio file format.

The value of this UTI is public.mp3. Files are identified with the .mp3 extension.

Available in iOS 7.0 and later.

Declared in AVMediaFormat.h.

AVFileTypeSunAU

UTI for the Sun/NeXT audio file format.

The value of this UTI is public.au-audio. Files are identified with the .au and .snd extensions.

Available in iOS 7.0 and later.

Declared in AVMediaFormat.h.

Core Animation

Support for integration with Core Animation.

const CFTimeInterval AVCoreAnimationBeginTimeAtZero
Constants
AVCoreAnimationBeginTimeAtZero

Use this constant to set the CoreAnimation's animation beginTime property to be time 0.

The constant is a small, non-zero, positive value which prevents CoreAnimation from replacing 0.0 with CACurrentMediaTime.

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
AVVideoScalingModeKey

A key to retrieve the video scaling mode from a dictionary.

Available in iOS 5.0 and later.

Declared in AVVideoSettings.h.

AVVideoScalingModeFit

Crop 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.

AVVideoScalingModeResize

Crop 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.

AVVideoScalingModeResizeAspect

Preserve 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.

AVVideoScalingModeResizeAspectFill

Preserve aspect ratio of the source, and crop picture to fit destination dimensions.

Available in iOS 5.0 and later.

Declared in AVVideoSettings.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
AVMediaCharacteristicIsMainProgramContent

Indicates 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 AVMediaCharacteristicIsAuxiliaryContent is considered to have the characteristic.

Available in iOS 5.0 and later.

Declared in AVMediaFormat.h.

AVMediaCharacteristicIsAuxiliaryContent

Indicates 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 AVMediaCharacteristicIsAuxiliaryContent if 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.

AVMediaCharacteristicContainsOnlyForcedSubtitles

Indicates 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.

AVMediaCharacteristicTranscribesSpokenDialogForAccessibility

Indicates 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 AVMediaCharacteristicTranscribesSpokenDialogForAccessibility only if it’s explicitly tagged with that characteristic.

Available in iOS 5.0 and later.

Declared in AVMediaFormat.h.

AVMediaCharacteristicDescribesMusicAndSoundForAccessibility

Indicates 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 AVMediaCharacteristicDescribesMusicAndSoundForAccessibility only if it’s explicitly tagged with that characteristic.

Available in iOS 5.0 and later.

Declared in AVMediaFormat.h.

AVMediaCharacteristicDescribesVideoForAccessibility

Indicates 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 AVMediaCharacteristicEasyToRead only if it’s explicitly tagged with that characteristic.

Available in iOS 5.0 and later.

Declared in AVMediaFormat.h.

AVMediaCharacteristicEasyToRead

Indicates 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 AVMediaCharacteristicEasyToRead only 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 object as 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];