Input tracks represent individual media streams (video, audio) within an input file. They provide access to track properties, codec information, and methods for reading encoded packets or decoded samples.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Vanilagy/mediabunny/llms.txt
Use this file to discover all available pages before exploring further.
InputTrack
Base class representing a media track in an input file.Properties
The input file this track belongs to.
The type of the track (‘video’, ‘audio’, or ‘subtitle’).
The codec of the track’s packets.
The unique ID of this track in the input file.
The 1-based index of this track among all tracks of the same type in the input file. For example, the first video track has number 1, the second video track has number 2, and so on.
The identifier of the codec used internally by the container. It is not homogenized by Mediabunny and depends entirely on the container format.
- For ISOBMFF files, this field returns the name of the Sample Description Box (e.g.
'avc1'). - For Matroska files, this field returns the value of the
CodecIDelement. - For WAVE files, this field returns the value of the format tag in the
'fmt 'chunk. - For ADTS files, this field contains the
MPEG-4 Audio Object Type. - For MPEG-TS files, this field contains the
streamTypevalue from the Program Map Table. - In all other cases, this field is
null.
The ISO 639-2/T language code for this track. If the language is unknown, this field is
'und' (undetermined).A user-defined name for this track.
A positive number x such that all timestamps and durations of all packets of this track are integer multiples of 1/x.
The track’s disposition, i.e. information about its intended usage.
Methods
getFirstTimestamp()
computeDuration()
getCodecParameterString()
canDecode()
determinePacketType()
computePacketStats()
Optional parameter that sets a target for how many packets this method must have looked at before it can return early. This means you can use it to aggregate only a subset (prefix) of all packets. This is very useful for getting a great estimate of video frame rate without having to scan through the entire file.
isVideoTrack()
isAudioTrack()
InputVideoTrack
Represents a video track in an input file. ExtendsInputTrack with video-specific properties and methods.
Properties
The video codec of this track.
The width in pixels of the track’s coded samples, before any transformations or rotations.
The height in pixels of the track’s coded samples, before any transformations or rotations.
The angle in degrees by which the track’s frames should be rotated (clockwise). Can be 0, 90, 180, or 270.
The pixel aspect ratio of the track’s frames, as a rational number in its reduced form. Most videos use square pixels (1:1).
The width of the track’s frames in square pixels, adjusted for pixel aspect ratio but before rotation.
The height of the track’s frames in square pixels, adjusted for pixel aspect ratio but before rotation.
The display width of the track’s frames in pixels, after aspect ratio adjustment and rotation.
The display height of the track’s frames in pixels, after aspect ratio adjustment and rotation.
Methods
getColorSpace()
hasHighDynamicRange()
canBeTransparent()
getDecoderConfig()
VideoDecoder. Returns null if the track’s codec is unknown.
InputAudioTrack
Represents an audio track in an input file. ExtendsInputTrack with audio-specific properties and methods.
Properties
The audio codec of this track.
The number of audio channels in the track.
The track’s audio sample rate in hertz.
Methods
getDecoderConfig()
AudioDecoder. Returns null if the track’s codec is unknown.