Skip to content

stream.hls_playlist: round BANDWIDTH and parse as int #3721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2021

Conversation

back-to
Copy link
Collaborator

@back-to back-to commented May 8, 2021

same as DASH Streams #1995


before

[cli][info] Available streams: 360p_364k (worst), 480p_764k, 720p_1564k, 720p_2564k, 576p_5008k, 720p_6891k, 720p_9726k (best)

now

[cli][info] Available streams: 360p_360k (worst), 480p_760k, 720p_1600k, 720p_2600k, 576p_5000k, 720p_6900k, 720p_9700k (best)

useful for #3708

same as DASH Streams streamlink#1995

---

before

```
[cli][info] Available streams: 360p_364k (worst), 480p_764k, 720p_1564k, 720p_2564k, 576p_5008k, 720p_6891k, 720p_9726k (best)
```

now

```
[cli][info] Available streams: 360p_360k (worst), 480p_760k, 720p_1600k, 720p_2600k, 576p_5000k, 720p_6900k, 720p_9700k (best)
```

---

useful for streamlink#3708
@@ -94,7 +95,7 @@ def create_stream_info(self, streaminf, cls=None):

bandwidth = streaminf.get("BANDWIDTH")
if bandwidth:
bandwidth = float(bandwidth)
bandwidth = round(float(bandwidth), 1 - int(math.log10(float(bandwidth))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is bandwidth parsed as a float?

https://tools.ietf.org/html/rfc8216#section-4.3.4.2

The following attributes are defined:

 BANDWIDTH

 The value is a decimal-integer of bits per second.  It represents
 the peak segment bit rate of the Variant Stream.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like it was a fix for the twitch plugin

4305c8c

chrippa/livestreamer#1397

@bastimeyer
Copy link
Member

Btw, the entire stream name+weights selection needs a major rewrite. We're currently guessing the stream weight from the yielded stream name in the streams dict instead of properly calculating the stream weights from various (additional) stream properties, like FPS for example. This would also fix issues with duplicates, but it'd probably be a breaking change, as this is part of the public API.

@bastimeyer bastimeyer changed the title stream.hls_playlist: round BANDWIDTH stream.hls_playlist: round BANDWIDTH and parse as int May 9, 2021
@bastimeyer bastimeyer merged commit 2884485 into streamlink:master May 9, 2021
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this pull request May 9, 2021
@back-to back-to deleted the round_bandwidth_hls branch May 22, 2021 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants