Instance Property


The format descriptions of the media samples referenced by the track.


var formatDescriptions: [Any] { get }


The array contains CMFormatDescriptions (see CMFormatDescription), each of which indicates the format of media samples referenced by the track.

Asset tracks commonly present uniform media (for example, encoded according to the same encoding settings) and will contain a single format description. However, there are cases where an asset track may contain multiple format descriptions. For instance, an H.264-encoded video track may have some of its segments encoded using the Main profile and others using the High profile. Additionally, an individual AVCompositionTrack, which is a subclass of AVAssetTrack, may contain audio or video segments using different codecs (aac, mp3, aiff, etc.).

You can use the CMFormatDescription to access low-level details about the media referenced by the track. For instance, you could retrieve the details of track’s media type and subtype as follows:

extension AVAssetTrack {
    var mediaFormat: String {
        var format = ""
        let descriptions = self.formatDescriptions as! [CMFormatDescription]
        for (index, formatDesc) in descriptions.enumerated() {
            // Get String representation of media type (vide, soun, sbtl, etc.)
            let type =
            // Get String representation media subtype (avc1, aac, tx3g, etc.)
            let subType =
            // Format string as type/subType
            format += "\(type)/\(subType)"
            // Comma separate if more than one format description
            if index < descriptions.count - 1 {
                format += ","
        return format
extension FourCharCode {
    // Create a String representation of a FourCC
    func toString() -> String {
        let bytes: [CChar] = [
            CChar((self >> 24) & 0xff),
            CChar((self >> 16) & 0xff),
            CChar((self >> 8) & 0xff),
            CChar(self & 0xff),
        let result = String(cString: bytes)
        let characterSet = CharacterSet.whitespaces
        return result.trimmingCharacters(in: characterSet)

See Also

Retrieving Track Information

var asset: AVAsset?

The asset of which the track is a part.

var trackID: CMPersistentTrackID

The persistent unique identifier for this track.

var mediaType: AVMediaType

The media type for the track.

func hasMediaCharacteristic(AVMediaCharacteristic) -> Bool

Returns a Boolean value that indicates whether the track references media with the specified media characteristic.

struct AVMediaCharacteristic

The options for specifying media type characteristics.

var isEnabled: Bool

A Boolean value that indicates whether the track is enabled according to the state stored in its container.

var isPlayable: Bool

A Boolean value that indicates whether the track is playable in the current environment.

var isSelfContained: Bool

A Boolean value that indicates whether the track references sample data contained only within its storage container.

var estimatedDataRate: Float

The estimated data rate, in bits per second, of the media data referenced by the track.

var totalSampleDataLength: Int64

The total number of bytes of sample data required by the track.

var isDecodable: Bool

A Boolean value that indicates whether the receiver is decodable in the current environment.