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, or subtitle).
Unless otherwise noted, a track selector will not select a track that is incompatible with the currently active protocol or container format.
Default track selection
Protocols within MistServer can be told what their default track selection should be for viewers and push out. This is setup within the Protocol itself within the Protocol panel. The option you're looking for would be Default track sorting. This has several options:
- Default
- Bit rate, low to high
- Bit rate, high to low
- Track ID, low to high
- Track ID, high to low
- Resolution, low to high
- Resolution, high to low New since 3.11
- Optimal
3.11+ default - Optimal
With 3.11 a new default selection "Optimal". This selections tries to select whatever track seems like the best quality for the least amount of bytes. Keep in mind that the Optimal setting is a heuristic so it can be wrong. In most cases however it should provide a good experience.
Pre-3.11 default
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.
Track selection
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. -
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.
-
source: Only selects tracks that are not created by a process, -
first: Selects the first matching track -
last: Selects the last matching track -
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. -
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. -
mono(video): Mono video can be selected to select the monochrome video track. -
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.
For resolution-based track selectors, note that surface area is used, not exact resolution. This means portrait/landscape cannot be distinguished from each other.
Examples
Sometimes examples help with understanding how the selection should be done, so we'll be giving a few examples here.
?video=source- This would select all source video tracks, which can be multiple.?video=source,|first- This would select the first source track for video, which is guaranteed to be one.?video=!h265- This would select any video track that is not H265?video=h264,h265- This would select all video tracks that are H264 and H265?video=~1920x1080,|maxbps,|h264&audio=opus,|stereo- This would select the highest bitrate H264 video track closest to 1920x1080 resolution and select the stereo opus track.
- If your video/audio track selectors are specified and there is no match you will get no video/audio.
- Pay attention to the difference between
selector,selector,selector,!selectorandselector,|selector