Skip to content
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

plugins.twitch: fix discontinuity warning spam #6022

Conversation

bastimeyer
Copy link
Member

Resolves #6015

Compared to #6016, this time it doesn't touch any ad filtering logic.
See #6015 (comment) why #6016 had to be reverted in #6019

@KynikossDragonn please check again if this does indeed fix all the discontinuty warning spam (apart from actual discontinuities between live and ad content)
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#pull-request-feedback

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Jun 5, 2024
Copy link
Member

@gravyboat gravyboat left a comment

Choose a reason for hiding this comment

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

I'll mark this as approved pending testing by the reporter.

@KynikossDragonn
Copy link

This unfortunately didn't seem to work out, I appear to be getting warned of discontinuities that aren't actually happening after the initial pre-roll ad:

[session][info] Plugin twitch is being overridden by /home/kynikos/.local/share/streamlink/plugins/twitch.py
[cli][info] Found matching plugin twitch for URL twitch.tv/doctorcdcs
[cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p60, 1080p60 (best)
[cli][info] Opening stream: 360p (hls)
[cli][info] Starting player: mpv
[plugins.twitch][info] Low latency streaming (HLS live edge: 1)
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[cli][info] Player closed
[cli][info] Stream ended
[cli][info] Closing currently open stream...

Here's a verbose log:
streamlink.txt.gz

@bastimeyer
Copy link
Member Author

Are you loading the right plugin version? I can't find any streams with the same playlist behavior, so I'm just relying on the added test data.

See this test fixture (from the current PR version)
c262b23#diff-48c96f8246c6a3e90a6bc303e504500d3a32f392bb876541469fa9b8de6915d9R404

which is the equivalent of this playlist data from your log output

[20:16:02.373832][stream.hls.m3u8][all] #EXT-X-PROGRAM-DATE-TIME:2024-06-06T01:15:56.627Z
[20:16:02.374206][stream.hls.m3u8][all] #EXTINF:2.000,live
[20:16:02.374597][stream.hls.m3u8][all] URL
[20:16:02.374878][stream.hls.m3u8][all] #EXT-X-DISCONTINUITY
[20:16:02.375099][stream.hls.m3u8][all] #EXT-X-TWITCH-LIVE-SEQUENCE:2249
[20:16:02.375443][stream.hls.m3u8][all] #EXT-X-PROGRAM-DATE-TIME:2024-06-06T01:15:58.627Z
[20:16:02.375741][stream.hls.m3u8][all] #EXTINF:2.000,live
[20:16:02.376007][stream.hls.m3u8][all] URL
[20:16:02.376403][stream.hls.m3u8][all] #EXT-X-TWITCH-PREFETCH:URL
[20:16:02.376766][stream.hls.m3u8][all] #EXT-X-TWITCH-PREFETCH:URL
[20:16:02.377407][stream.hls][debug] Adding segment 28 to queue
[20:16:03.826540][stream.hls][debug] Segment 27 complete
[20:16:03.827270][stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.

Basically a simple discontinuity between two non-ad segments, which should be ignored, so it surprises me to see these warnings in your log output.

@KynikossDragonn
Copy link

KynikossDragonn commented Jun 7, 2024

Are you loading the right plugin version? I can't find any streams with the same playlist behavior, so I'm just relying on the added test data.

Unless there's something somehow caching the previous version of the py file even though I overwrote it with the one from this PR, I should be using the right version. I'll try again some more later tonight.

UPDATE: I cleared anything that could possibly look like some sort of cache, redownloaded the py from the PR and ran with it again and ended up with my terminal completely flooded with the same warning still.

$ streamlink twitch.tv/fractalminddev
[session][info] Plugin twitch is being overridden by /home/kynikos/.local/share/streamlink/plugins/twitch.py
[cli][info] Found matching plugin twitch for URL twitch.tv/fractalminddev
[cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p60, 1080p60 (best)
[cli][info] Opening stream: 360p (hls)
[cli][info] Starting player: mpv
[plugins.twitch][info] Low latency streaming (HLS live edge: 1)
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[cli][info] Player closed
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[cli][info] Stream ended
[cli][info] Closing currently open stream...

@voidlily
Copy link

I was running into stream discontinuity issues as well today and found this issue. I tested against this branch and it didn't help. These are actual discontinuities and not just spurious log messages. I run with twitch-disable-ads, twitch-low-latency, and an oauth token from my browser.

I wonder if this might be an issue with low latency, because I tried without twitch-low-latency and the discontinuity errors went away

❯ [cli][info] Found matching plugin twitch for URL https://twitch.tv/missshadowlovely
[cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p, 720p60, 1080p60 (best)
[cli][info] Opening stream: 1080p60 (hls)
[cli][info] Starting player: mpv
[plugins.twitch][info] Will skip ad segments
[plugins.twitch][info] Low latency streaming (HLS live edge: 2)
[stream.hls][info] Filtering out segments and pausing stream output
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][info] Resuming stream output
[stream.hls][info] Filtering out segments and pausing stream output
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][info] Resuming stream output

@bastimeyer
Copy link
Member Author

[stream.hls][info] Filtering out segments and pausing stream output
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][info] Resuming stream output
[stream.hls][info] Filtering out segments and pausing stream output
[stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[stream.hls][info] Resuming stream output

These are actual discontinuities

Which means that both the #EXT-X-DISCONTINUITY HLS tags and the warning messages are valid. Remember that discontinuities are not supported and thus warnings must be emitted by Streamlink's HLS implementation, because the bitstream written to the output is incoherent.

Stream output pausing is related to ads filtering, so unless the ads detection is broken, this is working as intended. Without an "all" log output (--loglevel=all) which includes the actual HLS playlist content, nobody will be able to tell if there's an issue or not.

As said, I can't reproduce this, so this must only be the case for people who set authentication headers while being subscribed to certain channels. None of the "all" log outputs posted by @KynikossDragonn suggest any issues with prefetch segments (low latency segments).

@bastimeyer
Copy link
Member Author

Had another look at the changes of this PR and I think I understand the issue with prefetch segments now. I'll fix this tomorrow once I get the time. It's way too late here now.

@bastimeyer bastimeyer force-pushed the plugins/twitch/fix-discontinuity-warning-spam branch from c262b23 to 1267afe Compare June 20, 2024 20:23
@bastimeyer
Copy link
Member Author

I've updated the PR. Please re-check the new changes.

As said, I don't see the discontinuities in any HLS playlists myself, so this is purely based on the --loglevel=all log outputs which were uploaded here, which means I still could've missed some cases.

@KynikossDragonn
Copy link

I've updated the PR. Please re-check the new changes.

I've so far not have the warning repetitively show up with the latest change so I think the issue is properly resolved now.

@bastimeyer bastimeyer merged commit 22519a7 into streamlink:master Jun 23, 2024
23 checks passed
@bastimeyer bastimeyer deleted the plugins/twitch/fix-discontinuity-warning-spam branch June 23, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins.twitch: incorrect discontinuity tags lead to warnings being spammed
4 participants