Asset Track Matching
Matching rules
For a schedule to be valid, all assets must be compatible with the content template of the channel.
The compatibility check is done by a set of matching rules when a channel is created or when its schedule is updated. If one of the assets is not matching the content template, the schedule is discarded and an error is reported.
The matching is done by comparing the asset tracks with the tracks of the content template.
The first condition is equal media type. A video track will, for example, never be matched to an audio track.
The second condition depends on the media type of the track. Some media type-specific properties of a track, must always be identical to a track found in the content template for them to match. The table below lists the properties that must be identical for the respective media types between a track in an asset and a track in the content template.
Media type | Media properties that must match |
---|---|
Video | Media type subtype |
Audio | Media type subtype Codec Sample rate |
Subtitles | Media type Language Role |
The third condition regards the bitrate range.
By default, the bitrate of an asset track must be identical to the bitrate of
the corresponding content template track. However, the max_bitrate
and
min_bitrate
parameters in the content template allow for a range
of matching bitrates on track level.
More generally, there are also percentage values that can be specified for bitrates in either a channel configuration, or as global parameters at the top level of the config file or as command line parameters.
The channel parameters are called maxBitratePercentAbove
and maxBitratePercentBelow
,
while the global parameters are called defaultMaxBitratePercentAbove
and defaultMaxBitratePercentBelow
These are all optional with default value 0.
The rules for bitrate matching are applied in the following priority order:
- Use the track specific bitrate range if it exists
- Use the channel specific bitrate percentage range if it exists
- Use the command-line bitrate percentage range if it exists
- Use the top-level JSON bitrate percentage range if it exists
Only one of the rules will be applied (the one with the highest priority that is valid for the scope of the track we are trying to match to).
Cases of non-direct match
There does not need to be a one-to-one match between tracks. An asset which deviate from the content template in the following way should be accepted:
- Extra tracks are allowed and will be silently discarded
- Subtitle tracks may be missing. This results in corresponding empty subtitle segments
- Audio languages may be missing. Such a track will be replaced by tracks of another language. An example would be a channel where some programs are in English and some in Spanish.
Matching algorithm
The matching occurs when a schedule is being updated for a channel. If no match is found for any variant in any asset in the new schedule, the schedule is considered invalid, and an error is returned. The matching algorithm begins by sorting the variants in the content template by their bitrate in descending order. The same is done for every asset. Finally, each variant in the sorted list of template variants, will be matched with a compatible asset variant considering media type and the compatibility values listed in the table above.
The search for a compatible variant in the asset is started from the top of the sorted variant list in the content template. This ensures that the most appropriate variant in each asset will be coupled with a corresponding variant in the content template.