Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

AVAsset.TrackInfo

Queries track details.

Component Version macOS Windows Linux Server iOS SDK
AVAsset 7.4 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "AVAsset.TrackInfo"; Asset; TrackIndex; Selector )   More

Parameters

Parameter Description Example
Asset The reference number of the asset. Please use AVAsset.OpenContainer, AVAsset.OpenFile or AVAsset.OpenURL function to get asset reference. $asset
TrackIndex The track index from 0 to AVAsset.TrackCount-1. 0
Selector Which value to get. "MediaType"

Result

Returns value or error.

Description

Queries track details.
Allows you to query values for track.

SelectorDescription
trackIDIndicates the persistent unique identifier for this track of the asset
mediaTypeIndicates the media type for this track as 4 letter code. e.g. "vide" for video or "soun" for sound.
playableIndicates whether the receiver is playable in the current environment.
enabledIndicates whether the track is enabled according to state stored in its container or construct.
selfContainedIndicates whether the track references sample data only within its storage container.
totalSampleDataLengthIndicates the total number of bytes of sample data required by the track.
estimatedDataRateIndicates the estimated data rate of the media data referenced by the track, in units of bits per second.
naturalTimeScaleIndicates a timescale in which time values for the track can be operated upon without extraneous numerical conversion.
languageCodeIndicates the language associated with the track, as an ISO 639-2/T language code; may be "" if no language is indicated.
extendedLanguageTagIndicates the language tag associated with the track, as an IETF BCP 47 (RFC 4646) language identifier; may be "" if no language tag is indicated.
naturalWidthIndicates the natural dimensions of the media data referenced by the track.
naturalHeightIndicates the natural dimensions of the media data referenced by the track.
preferredVolumeIndicates the volume specified in the track's storage container as the preferred volume of the audible media data.
nominalFrameRateFor tracks that carry a full frame per media sample, indicates the frame rate of the track in units of frames per second.
minFrameDurationIndicates the minimum duration of the track's frames; the value will be kCMTimeInvalid if the minimum frame duration is not known or cannot be calculated.
timeRangeStartIndicates the time range of the track within the overall timeline of the asset
timeRangeDurationIndicates the time range of the track within the overall timeline of the asset
preferredTransformIndicates the transform specified in the track's storage container as the preferred transformation of the visual media data for display purposes; its value is often but not always identity
MediaSubTypeThe media subtype (codec).
formatDescriptionAsks AVAsset for a description of the first format in the track. (Added in 15.0)

CodeNameDescription
2vuy422YpCbCr8Component Y'CbCr 8-bit 4:2:2 ordered Cb Y'0 Cr Y'1
rle AnimationApple Animation format
cvidCinepakCinepak format
jpegJPEGJoint Photographic Experts Group (JPEG) format
dmb1JPEG_OpenDMLJPEG format with Open-DML extensions
SVQ1SorensonVideoSorenson video format
SVQ3SorensonVideo3Sorenson 3 video format
h263H263ITU-T H.263 format
avc1H264ITU-T H.264 format (AKA ISO/IEC 14496-10 - MPEG-4 Part 10, Advanced Video Coding format)
hvc1HEVCITU-T HEVC format
mp4vMPEG4VideoISO/IEC Moving Picture Experts Group (MPEG) MPEG-4 Part 2 video format
mp2vMPEG2VideoMPEG-2 video format
mp1vMPEG1VideoMPEG-1 video format
dvc DVCNTSCDV NTSC format
dvcpDVCPALDV PAL format
dvppDVCProPALPanasonic DVCPro PAL format
dv5nDVCPro50NTSCPanasonic DVCPro-50 NTSC format
dv5pDVCPro50PALPanasonic DVCPro-50 PAL format
dvhpDVCPROHD720p60Panasonic DVCPro-HD 720p60 format
dvhqDVCPROHD720p50Panasonic DVCPro-HD 720p50 format
dvh6DVCPROHD1080i60Panasonic DVCPro-HD 1080i60 format
dvh5DVCPROHD1080i50Panasonic DVCPro-HD 1080i50 format
dvh3DVCPROHD1080p30Panasonic DVCPro-HD 1080p30 format
dvh2DVCPROHD1080p25Panasonic DVCPro-HD 1080p25 format
ap4hAppleProRes4444Apple ProRes 4444 format
apchAppleProRes422HQApple ProRes 422 HQ format
apcnAppleProRes422Apple ProRes 422 format
apcsAppleProRes422LTApple ProRes 422 LT format
apcoAppleProRes422ProxyApple ProRes 422 Proxy format

Examples

Query media subtype:

MBS( "AVAsset.TrackInfo"; $Asset; 0; "MediaSubType" )

Let([
    asset = MBS( "AVAsset.OpenFile"; "/Users/cs/Downloads/test.mp3" );
    formatDescription = MBS( "AVAsset.TrackInfo"; Asset; 0; "formatDescription" );
    r = MBS( "AVAsset.Release"; Asset )
]; formatDescription)

Example result:
{ mediaType:'soun' mediaSubType:'.mp3' mediaSpecific: { ASBD: { mSampleRate: 44100.000000 mFormatID: '.mp3' mFormatFlags: 0x0 mBytesPerPacket: 0 mFramesPerPacket: 1152 mBytesPerFrame: 0 mChannelsPerFrame: 2 mBitsPerChannel: 0 } cookie: {(null)} ACL: {(null)} FormatList Array: { Index: 0 ChannelLayoutTag: 0x650002 ASBD: { mSampleRate: 44100.000000 mFormatID: '.mp3' mFormatFlags: 0x0 mBytesPerPacket: 0 mFramesPerPacket: 1152 mBytesPerFrame: 0 mChannelsPerFrame: 2 mBitsPerChannel: 0 }} } extensions: {(null)} }

See also

Release notes

  • Version 14.6
    • Added formatDescription as selector for AVAsset.TrackInfo to query format description information.
  • Version 7.4

Example Databases

Blog Entries

This function checks for a license.

Created 29th July 2017, last changed 22nd November 2024


AVAsset.TrackCount - AVAsset.URL