iOS Developer Library

Developer

AVFoundation Framework Reference AV Foundation Constants Reference

Options
Deployment Target:

On This Page
Language:

AV Foundation Constants Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

This document describes constants defined in the AV Foundation framework not described in individual classes or in domain-specific constants references. See also:

Constants

  • Constants to identify various media types.

    Declaration

    Swift

    let AVMediaTypeVideo: String let AVMediaTypeAudio: String let AVMediaTypeText: String let AVMediaTypeClosedCaption: String let AVMediaTypeSubtitle: String let AVMediaTypeTimecode: String let AVMediaTypeMetadata: String let AVMediaTypeMuxed: String

    Objective-C

    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

      AVMediaTypeVideo

      Specifies video.

      Available in iOS 4.0 and later.

    • AVMediaTypeAudio

      AVMediaTypeAudio

      Specifies audio.

      Available in iOS 4.0 and later.

    • AVMediaTypeText

      AVMediaTypeText

      Specifies text.

      Available in iOS 4.0 and later.

    • AVMediaTypeClosedCaption

      AVMediaTypeClosedCaption

      Specifies closed-caption content.

      Available in iOS 4.0 and later.

    • AVMediaTypeSubtitle

      AVMediaTypeSubtitle

      Specifies subtitles.

      Available in iOS 4.0 and later.

    • AVMediaTypeTimecode

      AVMediaTypeTimecode

      Specifies a time code.

      Available in iOS 4.0 and later.

    • AVMediaTypeTimedMetadata

      AVMediaTypeTimedMetadata

      Specifies timed metadata.

      Available in iOS 4.0 through iOS 5.1.

    • AVMediaTypeMetadata

      AVMediaTypeMetadata

      Specifies metadata.

      Available in iOS 6.0 and later.

    • AVMediaTypeMuxed

      AVMediaTypeMuxed

      Specifies muxed media.

      Available in iOS 4.0 and later.

  • These string constants define how the video is displayed within a layer’s bounds rectangle.

    Declaration

    Swift

    let AVLayerVideoGravityResize: String let AVLayerVideoGravityResizeAspect: String let AVLayerVideoGravityResizeAspectFill: String

    Objective-C

    NSString * const AVLayerVideoGravityResize; NSString * const AVLayerVideoGravityResizeAspect; NSString * const AVLayerVideoGravityResizeAspectFill;

    Constants

    • AVLayerVideoGravityResize

      AVLayerVideoGravityResize

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

      Available in iOS 4.0 and later.

    • AVLayerVideoGravityResizeAspect

      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.

    • AVLayerVideoGravityResizeAspectFill

      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.

    Discussion

    You use these constants when setting the videoGravity property of an AVPlayerLayer or AVCaptureVideoPreviewLayer instance.

  • Constants to specify the characteristics of media types.

    Declaration

    Swift

    let AVMediaCharacteristicVisual: String let AVMediaCharacteristicAudible: String let AVMediaCharacteristicLegible: String let AVMediaCharacteristicFrameBased: String

    Objective-C

    NSString *const AVMediaCharacteristicVisual; NSString *const AVMediaCharacteristicAudible; NSString *const AVMediaCharacteristicLegible; NSString *const AVMediaCharacteristicFrameBased;

    Constants

    • AVMediaCharacteristicVisual

      AVMediaCharacteristicVisual

      Indicates that the media is visual.

      Available in iOS 4.0 and later.

    • AVMediaCharacteristicAudible

      AVMediaCharacteristicAudible

      Indicates that the media is audible.

      Available in iOS 4.0 and later.

    • AVMediaCharacteristicLegible

      AVMediaCharacteristicLegible

      Indicates that the media is legible.

      Available in iOS 4.0 and later.

    • AVMediaCharacteristicFrameBased

      AVMediaCharacteristicFrameBased

      Indicates that the media is frame-based.

      Available in iOS 4.0 and later.

  • These constants define dictionary keys for configuring video compression and compression settings for video assets.

    Declaration

    Swift

    let AVVideoCodecKey: String let AVVideoCodecH264: String let AVVideoCodecJPEG: String let AVVideoWidthKey: String let AVVideoHeightKey: String let AVVideoCompressionPropertiesKey: String let AVVideoAverageBitRateKey: String let AVVideoQualityKey: String let AVVideoMaxKeyFrameIntervalKey: String let AVVideoProfileLevelKey: String let AVVideoProfileLevelH264Baseline30: String let AVVideoProfileLevelH264Baseline31: String let AVVideoProfileLevelH264Baseline41: String let AVVideoProfileLevelH264Main30: String let AVVideoProfileLevelH264Main31: String let AVVideoProfileLevelH264Main32: String let AVVideoProfileLevelH264Main41: String let AVVideoProfileLevelH264High40: String let AVVideoProfileLevelH264High41: String let AVVideoPixelAspectRatioKey: String let AVVideoPixelAspectRatioHorizontalSpacingKey: String let AVVideoPixelAspectRatioVerticalSpacingKey: String let AVVideoCleanApertureKey: String let AVVideoCleanApertureWidthKey: String let AVVideoCleanApertureHeightKey: String let AVVideoCleanApertureHorizontalOffsetKey: String let AVVideoCleanApertureVerticalOffsetKey: String

    Objective-C

    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

      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.

    • AVVideoCodecH264

      AVVideoCodecH264

      Specifies that the video was encoded using H264.

      Available in iOS 4.0 and later.

    • AVVideoCodecJPEG

      AVVideoCodecJPEG

      Specifies that the video was encoded using the JPEG encoder.

      Available in iOS 4.0 and later.

    • AVVideoWidthKey

      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.

    • AVVideoHeightKey

      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.

    • AVVideoCompressionPropertiesKey

      AVVideoCompressionPropertiesKey

      Specifies a key to access the compression properties.

      The corresponding value is an instance of NSDictionary.

      Available in iOS 4.0 and later.

    • AVVideoAverageBitRateKey

      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.

    • AVVideoQualityKey

      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.

    • AVVideoMaxKeyFrameIntervalKey

      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.

    • AVVideoProfileLevelKey

      AVVideoProfileLevelKey

      Specifies a key to access the video profile.

      Available in iOS 4.0 and later.

    • AVVideoProfileLevelH264Baseline30

      AVVideoProfileLevelH264Baseline30

      Specifies a baseline level 3.0 profile.

      Available in iOS 4.0 and later.

    • AVVideoProfileLevelH264Baseline31

      AVVideoProfileLevelH264Baseline31

      Specifies a baseline level 3.1 profile.

      Available in iOS 4.0 and later.

    • AVVideoProfileLevelH264Baseline41

      AVVideoProfileLevelH264Baseline41

      Specifies a baseline level 4.1 profile.

      Available in iOS 5.0 and later.

    • AVVideoProfileLevelH264Main30

      AVVideoProfileLevelH264Main30

      Specifies a main level 3.0 profile.

      Available in iOS 4.0 and later.

    • AVVideoProfileLevelH264Main31

      AVVideoProfileLevelH264Main31

      Specifies a main level 3.1 profile.

      Available in iOS 4.0 and later.

    • AVVideoProfileLevelH264Main32

      AVVideoProfileLevelH264Main32

      Specifies a main level 3.2 profile.

      Available in iOS 5.0 and later.

    • AVVideoProfileLevelH264Main41

      AVVideoProfileLevelH264Main41

      Specifies a main level 4.1 profile.

      Available in iOS 5.0 and later.

    • AVVideoProfileLevelH264High40

      AVVideoProfileLevelH264High40

      Specifies a high level 4.0 profile.

      Available in iOS 6.0 and later.

    • AVVideoProfileLevelH264High41

      AVVideoProfileLevelH264High41

      Specifies a high level 4.1 profile.

      Available in iOS 6.0 and later.

    • AVVideoPixelAspectRatioKey

      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.

    • AVVideoPixelAspectRatioHorizontalSpacingKey

      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.

    • AVVideoPixelAspectRatioVerticalSpacingKey

      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.

    • AVVideoCleanApertureKey

      AVVideoCleanApertureKey

      Specifies a key to access the clean aperture.

      The corresponding value is an instance of NSDictionary.

      Available in iOS 4.0 and later.

    • AVVideoCleanApertureWidthKey

      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.

    • AVVideoCleanApertureHeightKey

      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.

    • AVVideoCleanApertureHorizontalOffsetKey

      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.

    • AVVideoCleanApertureVerticalOffsetKey

      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.

  • These constants specify UTIs for various file formats.

    Declaration

    Swift

    let AVFileType3GPP: String let AVFileType3GPP2: String let AVFileTypeAIFC: String let AVFileTypeAIFF: String let AVFileTypeCoreAudioFormat: String let AVFileTypeAppleM4V: String let AVFileTypeMPEG4: String let AVFileTypeAppleM4A: String let AVFileTypeQuickTimeMovie: String let AVFileTypeWAVE: String let AVFileTypeAMR: String let AVFileTypeAC3: String let AVFileTypeMPEGLayer3: String let AVFileTypeSunAU: String

    Objective-C

    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

      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.

    • AVFileType3GPP2

      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.

    • AVFileTypeAIFC

      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.

    • AVFileTypeAIFF

      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.

    • AVFileTypeCoreAudioFormat

      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.

    • AVFileTypeAppleM4V

      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.

    • AVFileTypeMPEG4

      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.

    • AVFileTypeAppleM4A

      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.

    • AVFileTypeQuickTimeMovie

      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.

    • AVFileTypeWAVE

      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.

    • AVFileTypeAMR

      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.

    • AVFileTypeAC3

      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.

    • AVFileTypeMPEGLayer3

      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.

    • AVFileTypeSunAU

      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.

  • Support for integration with Core Animation.

    Declaration

    Swift

    let AVCoreAnimationBeginTimeAtZero: CFTimeInterval

    Objective-C

    const CFTimeInterval AVCoreAnimationBeginTimeAtZero

    Constants

    • AVCoreAnimationBeginTimeAtZero

      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.

  • Constants to specify how video should be scaled to fit a given area.

    Declaration

    Swift

    let AVVideoScalingModeKey: String let AVVideoScalingModeFit: String let AVVideoScalingModeResize: String let AVVideoScalingModeResizeAspect: String let AVVideoScalingModeResizeAspectFill: String

    Objective-C

    NSString *const AVVideoScalingModeKey; NSString *const AVVideoScalingModeFit; NSString *const AVVideoScalingModeResize; NSString *const AVVideoScalingModeResizeAspect; NSString *const AVVideoScalingModeResizeAspectFill;

    Constants

    • AVVideoScalingModeKey

      AVVideoScalingModeKey

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

      Available in iOS 5.0 and later.

    • AVVideoScalingModeFit

      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.

    • AVVideoScalingModeResize

      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.

    • AVVideoScalingModeResizeAspect

      AVVideoScalingModeResizeAspect

      Preserve aspect ratio of the source, and fill remaining areas with black to fit destination dimensions.

      Available in iOS 5.0 and later.

    • AVVideoScalingModeResizeAspectFill

      AVVideoScalingModeResizeAspectFill

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

      Available in iOS 5.0 and later.

  • Media characteristic that may be present in an AVMediaSelectionOption object.

    Declaration

    Swift

    let AVMediaCharacteristicIsMainProgramContent: String let AVMediaCharacteristicIsAuxiliaryContent: String let AVMediaCharacteristicContainsOnlyForcedSubtitles: String let AVMediaCharacteristicTranscribesSpokenDialogForAccessibility: String let AVMediaCharacteristicDescribesMusicAndSoundForAccessibility: String let AVMediaCharacteristicDescribesVideoForAccessibility: String let AVMediaCharacteristicEasyToRead: String

    Objective-C

    NSString *const AVMediaCharacteristicIsMainProgramContent; NSString *const AVMediaCharacteristicIsAuxiliaryContent; NSString *const AVMediaCharacteristicContainsOnlyForcedSubtitles; NSString *const AVMediaCharacteristicTranscribesSpokenDialogForAccessibility; NSString *const AVMediaCharacteristicDescribesMusicAndSoundForAccessibility; NSString *const AVMediaCharacteristicDescribesVideoForAccessibility; NSString *const AVMediaCharacteristicEasyToRead;

    Constants

    • AVMediaCharacteristicIsMainProgramContent

      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.

    • AVMediaCharacteristicIsAuxiliaryContent

      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.

    • AVMediaCharacteristicContainsOnlyForcedSubtitles

      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.

    • AVMediaCharacteristicTranscribesSpokenDialogForAccessibility

      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.

    • AVMediaCharacteristicDescribesMusicAndSoundForAccessibility

      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.

    • AVMediaCharacteristicDescribesVideoForAccessibility

      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.

    • AVMediaCharacteristicEasyToRead

      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.

    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 NOfalse 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];