-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
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) |
- Actual behavior
V 2514.252
A 61.436
[cli][info] Available streams: 2514k
- Expected
V 2500.0
A 60.0
[cli][info] Available streams: 2500k
- Actual behavior
V 2433.165
A 61.439
[cli][info] Available streams: 2433k
- Expected
V 2400.0
A 60.0
[cli][info] Available streams: 2400k
Reproduction steps / Explicit stream URLs to test
- 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
streamlink/src/streamlink/stream/dash.py
Lines 204 to 206 in 71a327a
| 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)) |