Track selectors
Track selectors allow you to specify which tracks inside a stream you want to address. A track selector is always specific to a given track type (audio, video, subtitle or metadata).
Unless otherwise noted, a track selector will not select a track that is incompatible with the currently active protocol or container format.
If no track selector is used for any track type, the default for non-live streams is to pick the first compatible track of that type.
For live streams, the last compatible track of that type is selected instead. This default behaviour is skipped if any non-empty track selector is applied to that track type whatsoever.
Types
video: Selector applies to video tracksaudio: Selector applies to audio trackssubtitle: Selector applies to subtitle tracksmeta: Selector applies to metadata tracks
Selector syntax
Track selectors consist of a string value which may be any of the following:
-
selector,selector: Selects the union of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right. -
selector,!selector: Selects the difference of the given selectors. Specifically, all tracks part of the first selector that are not part of the second selector. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right. -
selector,|selector: Selects the intersection of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.
Selectors
Some selectors work for all track types, others would only be applied to a certain category. A good example would be resolution working only for video tracks as audio, subtitle or metadata generally doesnot have one.
All tracks types
-
noneor-1: Selects no tracks of this type. -
allor*: Selects all tracks of this type. -
#where # is any positive integer. Select this specific MistServer internal track ID. Does not apply if the given track ID does not exist or is of the wrong type. Does apply if the given track ID is incompatible with the currently active protocol or container format. The MistServer internal track ID is highly determined by the order in which tracks of incoming streams are recognized. -
i#where # is any positive integer. Select the specific stream track ID. This is the track ID according to the stream data. Depending on the protocol it could be specified as thepidinstead. Using this can be quite helpful when you're guaranteed of the stream track ID, but not the order in which they will arrive. For example selecting?video=i256to always select track ID 256 for video. -
ISO 639-1/639-3 language code: Select all tracks marked as the given language. Case insensitive.
-
Codec string (e.g.
h264): Select all tracks of the given codec. Case insensitive. -
highbps,maxbpsorbestbps: Select the track of this type with the highest bit rate. -
lowbps,minbpsorworstbps: Select the track of this type with the lowest bit rate. -
XbpsorXkbpsorXmbps: Select the single of this type which has a bit rate closest to the given number X. This number is in bits, not bytes. -
>Xbpsor>Xkbpsor>Xmbps: Select all tracks of this type which have a bit rate greater than the given number X. This number is in bits, not bytes. -
<Xbpsor<Xkbpsor<Xmbps: Select all tracks of this type which have a bit rate less than the given number X. This number is in bits, not bytes. -
max<Xbpsormax<Xkbpsormax<Xmbps: Select the one track of this type which has the highest bit rate less than the given number X. This number is in bits, not bytes.
Video only
For resolution-based track selectors, note that surface area is used, not exact resolution. This means portrait/landscape cannot be distinguished from each other.
-
highres,maxresorbestres: Select the track of this type with the highest pixel surface area. Only applied when the track type is video. -
lowres,minresorworstres: Select the track of this type with the lowest pixel surface area. Only applied when the track type is video. -
XxY: Select all tracks of this type with the given pixel surface area in X by Y pixels. Only applied when the track type is video. -
~XxY: Select the single track of this type closest to the given pixel surface area in X by Y pixels. Only applied when the track type is video. -
>XxY: Select all tracks of this type with a pixel surface area greater than X by Y pixels. Only applied when the track type is video. -
<XxY: Select all tracks of this type with a pixel surface area less than X by Y pixels. Only applied when the track type is video. -
720p,1080p,1440p,2k,4k,5k, or8k: Select all tracks of this type with the given pixel surface area. Only applied when the track type is video.
Audio only
surround,mono,stereo,Xch: Select all tracks of this type with the given channel count. The 'Xch' variant can use any positive integer for 'X'. Only applied when the track type is audio.
Examples
Example 01
?video=0,1&audio=3
This would select video track 0 and 1 and audio track 3. Leaving a 2 video and 1 audio track in the push or view request.
Example02
?video=h264,!lowest&audio=opus,aac
This would select all H264 tracks available and then drop the lowest quality one, leaving any others available within the selection. While also adding any opus and aac audio track.
Example03
?video=h264,|maxbps
This would only select a video track if H264 is the highest bitrate track available, otherwise no video at all will be selected. If a HEVC track would be higher bitrate you would end up with no video.
Example04
video=i256&audio=i257
This would select video if there is a video with track id 256 available and audio if there's an audio with track id 257 available.