Mac Developer Library

Developer

AVFoundation Framework Reference AV Foundation Constants Reference

Options
Deployment Target:

On This Page
Language:

AV Foundation Constants Reference

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: NSString! let AVMediaTypeAudio: NSString! let AVMediaTypeText: NSString! let AVMediaTypeClosedCaption: NSString! let AVMediaTypeSubtitle: NSString! let AVMediaTypeTimecode: NSString! let AVMediaTypeMetadata: NSString! let AVMediaTypeMuxed: NSString!

    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 OS X v10.7 and later.

    • AVMediaTypeAudio

      AVMediaTypeAudio

      Specifies audio.

      Available in OS X v10.7 and later.

    • AVMediaTypeText

      AVMediaTypeText

      Specifies text.

      Available in OS X v10.7 and later.

    • AVMediaTypeClosedCaption

      AVMediaTypeClosedCaption

      Specifies closed-caption content.

      Available in OS X v10.7 and later.

    • AVMediaTypeSubtitle

      AVMediaTypeSubtitle

      Specifies subtitles.

      Available in OS X v10.7 and later.

    • AVMediaTypeTimecode

      AVMediaTypeTimecode

      Specifies a time code.

      Available in OS X v10.7 and later.

    • AVMediaTypeTimedMetadata

      AVMediaTypeTimedMetadata

      Specifies timed metadata.

      Available in OS X v10.7 through OS X v10.7.

    • AVMediaTypeMetadata

      AVMediaTypeMetadata

      Specifies metadata.

      Available in OS X v10.8 and later.

    • AVMediaTypeMuxed

      AVMediaTypeMuxed

      Specifies muxed media.

      Available in OS X v10.7 and later.

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

    Declaration

    Swift

    let AVLayerVideoGravityResize: NSString! let AVLayerVideoGravityResizeAspect: NSString! let AVLayerVideoGravityResizeAspectFill: NSString!

    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 OS X v10.7 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 OS X v10.7 and later.

    • AVLayerVideoGravityResizeAspectFill

      AVLayerVideoGravityResizeAspectFill

      Specifies that the player should preserve the video’s aspect ratio and fill the layer’s bounds.

      Available in OS X v10.7 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: NSString! let AVMediaCharacteristicAudible: NSString! let AVMediaCharacteristicLegible: NSString! let AVMediaCharacteristicFrameBased: NSString!

    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 OS X v10.7 and later.

    • AVMediaCharacteristicAudible

      AVMediaCharacteristicAudible

      Indicates that the media is audible.

      Available in OS X v10.7 and later.

    • AVMediaCharacteristicLegible

      AVMediaCharacteristicLegible

      Indicates that the media is legible.

      Available in OS X v10.7 and later.

    • AVMediaCharacteristicFrameBased

      AVMediaCharacteristicFrameBased

      Indicates that the media is frame-based.

      Available in OS X v10.7 and later.

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

    Declaration

    Swift

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

    Objective-C

    NSString *const AVVideoCodecKey; NSString *const AVVideoCodecH264; NSString *const AVVideoCodecJPEG; NSString *const AVVideoCodecAppleProRes4444; NSString *const AVVideoCodecAppleProRes422; 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 OS X v10.7 and later.

    • AVVideoCodecH264

      AVVideoCodecH264

      Specifies that the video was encoded using H264.

      Available in OS X v10.7 and later.

    • AVVideoCodecJPEG

      AVVideoCodecJPEG

      Specifies that the video was encoded using the JPEG encoder.

      Available in OS X v10.7 and later.

    • AVVideoCodecAppleProRes4444

      AVVideoCodecAppleProRes4444

      Specifies that the video was encoded using the Apple ProRes 4444 encoder.

      Files are identified with the .ap4h extension.

      Available in OS X v10.7 and later.

    • AVVideoCodecAppleProRes422

      AVVideoCodecAppleProRes422

      Specifies that the video was encoded using the ProRes 422 Standard Definition encoder.

      Files are identified with the .apcn extension.

      Available in OS X v10.7 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 OS X v10.7 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 OS X v10.7 and later.

    • AVVideoCompressionPropertiesKey

      AVVideoCompressionPropertiesKey

      Specifies a key to access the compression properties.

      The corresponding value is an instance of NSDictionary.

      Available in OS X v10.7 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 OS X v10.7 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 OS X v10.7 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 OS X v10.7 and later.

    • AVVideoProfileLevelKey

      AVVideoProfileLevelKey

      Specifies a key to access the video profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264Baseline30

      AVVideoProfileLevelH264Baseline30

      Specifies a baseline level 3.0 profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264Baseline31

      AVVideoProfileLevelH264Baseline31

      Specifies a baseline level 3.1 profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264Baseline41

      AVVideoProfileLevelH264Baseline41

      Specifies a baseline level 4.1 profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264Main30

      AVVideoProfileLevelH264Main30

      Specifies a main level 3.0 profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264Main31

      AVVideoProfileLevelH264Main31

      Specifies a main level 3.1 profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264Main32

      AVVideoProfileLevelH264Main32

      Specifies a main level 3.2 profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264Main41

      AVVideoProfileLevelH264Main41

      Specifies a main level 4.1 profile.

      Available in OS X v10.8 and later.

    • AVVideoProfileLevelH264High40

      AVVideoProfileLevelH264High40

      Specifies a high level 4.0 profile.

      Available in OS X v10.9 and later.

    • AVVideoProfileLevelH264High41

      AVVideoProfileLevelH264High41

      Specifies a high level 4.1 profile.

      Available in OS X v10.9 and later.

    • AVVideoPixelAspectRatioKey

      AVVideoPixelAspectRatioKey

      Specifies a key to access the pixel aspect ratio.

      The corresponding value is an instance of NSDictionary.

      Available in OS X v10.7 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 OS X v10.7 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 OS X v10.7 and later.

    • AVVideoCleanApertureKey

      AVVideoCleanApertureKey

      Specifies a key to access the clean aperture.

      The corresponding value is an instance of NSDictionary.

      Available in OS X v10.7 and later.

    • AVVideoCleanApertureWidthKey

      AVVideoCleanApertureWidthKey

      Specifies a key to access the clean aperture width.

      The corresponding value is an instance of NSNumber.

      Available in OS X v10.7 and later.

    • AVVideoCleanApertureHeightKey

      AVVideoCleanApertureHeightKey

      Specifies a key to access the clean aperture height.

      The corresponding value is an instance of NSNumber.

      Available in OS X v10.7 and later.

    • AVVideoCleanApertureHorizontalOffsetKey

      AVVideoCleanApertureHorizontalOffsetKey

      Specifies a key to access the clean aperture horizontal offset.

      The corresponding value is an instance of NSNumber.

      Available in OS X v10.7 and later.

    • AVVideoCleanApertureVerticalOffsetKey

      AVVideoCleanApertureVerticalOffsetKey

      Specifies a key to access the clean aperture vertical offset.

      The corresponding value is an instance of NSNumber.

      Available in OS X v10.7 and later.

  • These constants specify UTIs for various file formats.

    Declaration

    Swift

    let AVFileTypeAIFC: NSString! let AVFileTypeAIFF: NSString! let AVFileTypeCoreAudioFormat: NSString! let AVFileTypeAppleM4V: NSString! let AVFileTypeMPEG4: NSString! let AVFileTypeAppleM4A: NSString! let AVFileTypeQuickTimeMovie: NSString! let AVFileTypeWAVE: NSString! let AVFileTypeAMR: NSString! let AVFileTypeAC3: NSString! let AVFileTypeMPEGLayer3: NSString! let AVFileTypeSunAU: NSString!

    Objective-C

    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

    • 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 OS X v10.7 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 OS X v10.7 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 OS X v10.7 and later.

    • AVFileTypeAppleM4V

      AVFileTypeAppleM4V

      UTI 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 OS X v10.7 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 OS X v10.7 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 OS X v10.7 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 OS X v10.7 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 OS X v10.7 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 OS X v10.7 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 OS X v10.9 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 OS X v10.9 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 OS X v10.9 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 OS X v10.7 and later.

  • Key to specify video properties, and corresponding keys and values for the color primary, transfer function, and Y'CbCr matrix.

    Declaration

    Swift

    let AVVideoColorPropertiesKey: NSString! let AVVideoColorPrimariesKey: NSString! let AVVideoColorPrimaries_ITU_R_709_2: NSString! let AVVideoColorPrimaries_EBU_3213: NSString! let AVVideoColorPrimaries_SMPTE_C: NSString! let AVVideoTransferFunctionKey: NSString! let AVVideoTransferFunction_ITU_R_709_2: NSString! let AVVideoTransferFunction_SMPTE_240M_1995: NSString! let AVVideoYCbCrMatrixKey: NSString! let AVVideoYCbCrMatrix_ITU_R_709_2: NSString! let AVVideoYCbCrMatrix_ITU_R_601_4: NSString! let AVVideoYCbCrMatrix_SMPTE_240M_1995: NSString!

    Objective-C

    NSString *const AVVideoColorPropertiesKey; NSString *const AVVideoColorPrimariesKey; NSString *const AVVideoColorPrimaries_ITU_R_709_2; NSString *const AVVideoColorPrimaries_EBU_3213; NSString *const AVVideoColorPrimaries_SMPTE_C; NSString *const AVVideoTransferFunctionKey; NSString *const AVVideoTransferFunction_ITU_R_709_2; NSString *const AVVideoTransferFunction_SMPTE_240M_1995; NSString *const AVVideoYCbCrMatrixKey; NSString *const AVVideoYCbCrMatrix_ITU_R_709_2; NSString *const AVVideoYCbCrMatrix_ITU_R_601_4; NSString *const AVVideoYCbCrMatrix_SMPTE_240M_1995;

    Constants

    • AVVideoColorPropertiesKey

      AVVideoColorPropertiesKey

      The key for a dictionary that contains properties specifying video color.

      The dictionary must contain the keys AVVideoColorPrimariesKey, AVVideoTransferFunctionKey, and AVVideoYCbCrMatrixKey.

      Available in OS X v10.7 and later.

    • AVVideoColorPrimariesKey

      AVVideoColorPrimariesKey

      The key to identify color primaries in a color properties dictionary.

      Available in OS X v10.7 and later.

    • AVVideoColorPrimaries_ITU_R_709_2

      AVVideoColorPrimaries_ITU_R_709_2

      Available in OS X v10.7 and later.

    • AVVideoColorPrimaries_EBU_3213

      AVVideoColorPrimaries_EBU_3213

      Available in OS X v10.7 and later.

    • AVVideoColorPrimaries_SMPTE_C

      AVVideoColorPrimaries_SMPTE_C

      Available in OS X v10.7 and later.

    • AVVideoTransferFunctionKey

      AVVideoTransferFunctionKey

      The key to identify the transfer function in a color properties dictionary.

      Available in OS X v10.7 and later.

    • AVVideoTransferFunction_ITU_R_709_2

      AVVideoTransferFunction_ITU_R_709_2

      Available in OS X v10.7 and later.

    • AVVideoTransferFunction_SMPTE_240M_1995

      AVVideoTransferFunction_SMPTE_240M_1995

      Available in OS X v10.7 and later.

    • AVVideoYCbCrMatrixKey

      AVVideoYCbCrMatrixKey

      The key to identify the Y'CbCr matrix in a color properties dictionary.

      Available in OS X v10.7 and later.

    • AVVideoYCbCrMatrix_ITU_R_709_2

      AVVideoYCbCrMatrix_ITU_R_709_2

      Available in OS X v10.7 and later.

    • AVVideoYCbCrMatrix_ITU_R_601_4

      AVVideoYCbCrMatrix_ITU_R_601_4

      Available in OS X v10.7 and later.

    • AVVideoYCbCrMatrix_SMPTE_240M_1995

      AVVideoYCbCrMatrix_SMPTE_240M_1995

      Available in OS X v10.7 and later.

    Discussion

    If you specify the AVVideoColorPropertiesKey, you must specify a color primary, transfer function, and Y'CbCr matrix. Typically you specify HD, which consists of AVVideoColorPrimaries_ITU_R_709_2 AVVideoTransferFunction_ITU_R_709_2, and AVVideoYCbCrMatrix_ITU_R_709_2.

    If you require SD colorimetry use AVVideoColorPrimaries_SMPTE_C, AVVideoTransferFunction_ITU_R_709_2, and AVVideoYCbCrMatrix_ITU_R_601_4.

    AVFoundation will color match if the source and destination color properties differ.

    It is important that the source be tagged.

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

    Declaration

    Swift

    let AVVideoScalingModeKey: NSString! let AVVideoScalingModeFit: NSString! let AVVideoScalingModeResize: NSString! let AVVideoScalingModeResizeAspect: NSString! let AVVideoScalingModeResizeAspectFill: NSString!

    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 OS X v10.7 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 OS X v10.7 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 OS X v10.7 and later.

    • AVVideoScalingModeResizeAspect

      AVVideoScalingModeResizeAspect

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

      Available in OS X v10.7 and later.

    • AVVideoScalingModeResizeAspectFill

      AVVideoScalingModeResizeAspectFill

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

      Available in OS X v10.7 and later.

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

    Declaration

    Swift

    let AVMediaCharacteristicIsMainProgramContent: NSString! let AVMediaCharacteristicIsAuxiliaryContent: NSString! let AVMediaCharacteristicContainsOnlyForcedSubtitles: NSString! let AVMediaCharacteristicTranscribesSpokenDialogForAccessibility: NSString! let AVMediaCharacteristicDescribesMusicAndSoundForAccessibility: NSString! let AVMediaCharacteristicDescribesVideoForAccessibility: NSString! let AVMediaCharacteristicEasyToRead: NSString!

    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 OS X v10.8 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 OS X v10.8 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 OS X v10.8 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 OS X v10.8 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 OS X v10.8 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 OS X v10.8 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 OS X v10.8 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];