Skip to content

stream name is inconsistent for dash dynamic playlists #1984

@back-to

Description

@back-to

Bug / Feature Report

  • This is a bug report and I have read the contribution guidelines.

Description

A dash dynamic playlist has different bandwidths all the time,
which makes the stream name inconsistent.

If you want to switch to the dash stream you can't guess the stream name.

streamlink URL 2500k,2400k would be easier than 2500k,2499k,2498k ...

It is not a big issue for streams with only one stream,
but if you want the lower stream there is a big chance that you won't guess the right stream name.

Expected / Actual behavior

Video and Audio bandwidth from self.bandwidth

self.bandwidth = self.attr(u"bandwidth", parser=lambda b: float(b) / 1000.0, required=True)

  1. Actual behavior
V 2514.252
A 61.436

[cli][info] Available streams: 2514k
  1. Expected
V 2500.0
A 60.0

[cli][info] Available streams: 2500k

  1. Actual behavior
V 2433.165
A 61.439

[cli][info] Available streams: 2433k
  1. Expected
V 2400.0
A 60.0

[cli][info] Available streams: 2400k

Reproduction steps / Explicit stream URLs to test

  1. DASHStream from https://ltv.lsm.lv/lv/tieshraide/visiemltv.lv/live.1480/

Additional comments, screenshots, etc.

The bandwidth should be rounded,

here is an example of how it could be rounded,
but it is a bit long and maybe it could be shortened.

        x = self.bandwidth
        if x >= 1000:
            x = round(x, -2)
        elif 1000 > x <= 100:
            x = round(x, -1)
        else:
            x = round(x)

it could be added to

self.bandwidth = self.attr(u"bandwidth", parser=lambda b: float(b) / 1000.0, required=True)

or

stream_name.append("{:0.0f}{}".format(vid.height or vid.bandwidth, "p" if vid.height else "k"))
if audio and len(audio) > 1:
stream_name.append("a{:0.0f}k".format(aud.bandwidth))

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