Structure

AVMediaCharacteristic

The options for specifying media type characteristics.

Declaration

struct AVMediaCharacteristic

Overview

Each track of .mov files and .m4v files (that is, files of type mov and m4v) 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, tag a track containing audio that mixes original program content with additional narrative descriptions of visual action 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 user data as a user data 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 user data 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 to infer the characteristic from its media type or format descriptions (such as audible or containsOnlyForcedSubtitles) or requires explicit tagging (such as transcribesSpokenDialogForAccessibility or easyToRead). You can't use explicit tagging to override inferences from tracks' media types or format descriptions; for example, the following returns false for any audio track, even when tagging the the track with the visual characteristic.

[anAVAssetTrack hasMediaCharacteristic:AVMediaCharacteristicVisual]

You can write tagged media characteristics to the QuickTime user data of an output track associated with an AVAssetWriterInput object as follows, provided that the output file type of the asset writer is either mov or m4v:

AVMutableMetadataItem *myTaggedMediaCharacteristic = [[AVMutableMetadataItem alloc] init];
[myTaggedMediaCharacteristic setKey:AVMetadataQuickTimeUserDataKeyTaggedCharacteristic];
[myTaggedMediaCharacteristic setKeySpace:AVMetadataKeySpaceQuickTimeUserData];
[myTaggedMediaCharacteristic setValue:aMeaningfulCharacteristicAsNSString];
[myMutableArrayOfMetadata addObject:myTaggedMediaCharacteristic];
[myAssetWriterInput setMetadata:myMutableArrayOfMetadata];

Topics

Media Characteristics

static let containsOnlyForcedSubtitles: AVMediaCharacteristic

The options present only forced subtitles.

static let describesMusicAndSoundForAccessibility: AVMediaCharacteristic

The option includes legible content in the language of its specified locale that describes music and sound effects occurring in program audio.

static let describesVideoForAccessibility: AVMediaCharacteristic

The option includes audible content that describes the visual portion of the presentation.

static let dubbedTranslation: AVMediaCharacteristic

The track or media selection option contains a language or dialect translation of originally or previously produced content.

static let easyToRead: AVMediaCharacteristic

The option provides legible content in the language of its specified locale and that the content so that it's easier to read.

static let isAuxiliaryContent: AVMediaCharacteristic

The option includes content marked by the content author as secondary to the presentation of the asset.

static let isMainProgramContent: AVMediaCharacteristic

The option includes content marked by the content author as intrinsic to the presentation of the asset.

static let languageTranslation: AVMediaCharacteristic

The option contains a language or dialect translation of origianlly or previously produced content.

static let transcribesSpokenDialogForAccessibility: AVMediaCharacteristic

The option includes legible content in the language of its specified locale that transcribes spoken dialog.

static let usesWideGamutColorSpace: AVMediaCharacteristic

The track uses a wide gamut color space and can make use of colors that can't be accurately represented otherwise.

static let voiceOverTranslation: AVMediaCharacteristic

The option contains a language translation created by adding a verbal interporetation of dialog and translations.

Relationships

See Also

Supporting Types

Video Settings Dictionaries

Define output image and video formats by using these key and value constants.

Video Settings

Dictionary keys for configuring video compression and compression settings for video assets.

struct AVFileType

A uniform type identifier for various file formats.

struct AVMediaType

An identifier for various media types.