Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
bastimeyer merged 2 commits into
streamlink:masterfrom
back-to:round_bandwidth_hls
May 9, 2021
Merged

stream.hls_playlist: round BANDWIDTH and parse as int#3721
bastimeyer merged 2 commits into
streamlink:masterfrom
back-to:round_bandwidth_hls

Conversation

@back-to

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

Copy link
Copy Markdown
Collaborator

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
Comment thread src/streamlink/stream/hls_playlist.py Outdated
bandwidth = streaminf.get("BANDWIDTH")
if bandwidth:
bandwidth = float(bandwidth)
bandwidth = round(float(bandwidth), 1 - int(math.log10(float(bandwidth))))

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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