Skip to content

Fallback selection for --stream-sorting-excludes #1055

@bastimeyer

Description

@bastimeyer

Checklist

  • This is a bug report.
  • This is a feature request.
  • This is a plugin (improvement) request.
  • I have read the contribution guidelines.

Description

Related issue:
streamlink/streamlink-twitch-gui#481

In certain situations, the usage of --stream-sorting-excludes can lead to an empty stream selection. This is an issue for applications which try to map the available streams to a custom list of qualities.

The Streamlink Twitch GUI needs to do this stream quality mapping because of Twitch's inconsistent quality naming. This is an example of trying to find the "low" quality:

# available: 160p, 360p, 480p, 720p, 1080p
streamlink --stream-sorting-excludes ">360p" twitch.tv/CHANNEL low,best
# will open 360p

# available: low, medium, high, source
streamlink --stream-sorting-excludes ">360p" twitch.tv/CHANNEL low,best
# will open low

# available: 720p
streamlink --stream-sorting-excludes ">360p" twitch.tv/CHANNEL low,best
# returns an empty selection (channel doesn't have re-encoded qualities)

Having a fallback parameter (eg. --stream-sorting-excludes-fallback) with a list of streams that will be opened if no matching stream could be found would fix this situation.

Another solution could be having a different notation in the actual quality selection, but this is probably a bit too complex.

# 1. try to find the quality labeled "medium"
# 2. look for qualities named by video resolution matching the defined range
# 3. fall back to lower qualities
# 4. use any available quality
streamlink twitch.tv/CHANNEL "medium||>360p&&<=480p||<=360p||best"
streamlink twitch.tv/CHANNEL "medium,>360p<=480p,<=360p,best"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions