-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
stream.hls: Support for EXT-X-DISCONTINUITY tag #4535
Comments
It's unlikely that
HLS implementations which are directly tied to a video/audio renderer in a single application can control/handle discontinuities, because the renderer's state can be reset, which is the intention of this HLS tag. Streamlink can't do this, as it's a standalone HLS client, and its only purpose is to output a single stream. A different solution on the CLI side could be writing streams to a variable number of (lazily created) named pipes and making players read from them. The problem here however would be telling the player to switch to a different input. This could be done via IPC interfaces of known players like MPV for example, or by passing the player a playlist of a fixed number of non-lazily created named pipes as input. Another problem would also be that Streamlink doesn't know when the player is finished displaying the content, so if the stream data gets read too fast by the player, a switch to the next stream via IPC commands would happen too soon. This solution is way too specific and error-prone, and is thus not useful. In case of recording, stream discontinuities are (technically) less of a problem, and something could be implemented so that multiple files get written to the filesystem whenever a discontinuity occurs, but since Streamlink's focus is on live streaming and not recording, a special case exception for this most likely won't get implemented. The only exceptions implemented for HLS discontinuities are in terms of "ad-blockers" for live streams, so that a single "cohesive" stream can be output by Streamlink that doesn't crash the player's demuxer/renderer. See the Twitch plugin for example. If your goal is to record an HLS stream with discontinuities, then Streamlink is not the right tool for you. |
Just want to chime in here, especially about this bit:
I know this is the stated purpose of the software, but many people (myself included) use streamlink for its recording features. AFAIK, the only other software that can handle such a wide set of live streams is youtube-dl/yt-dlp, but I personally find its live recording functionality unintuitive and easy to screw up. Therefore, if I want to record live, streamlink is the preferred tool. As a side note, I actually find that streamlink does handle HLS discontinuities quite well when sending the stream to a player, such as VLC. The only problem is that when casting from VLC, the stream stalls whenever a discontinuity is reached, but this is clearly an issue on the VLC side, not streamlink.
Again, I understand this sentiment by the dev team. However, I don't know of any tool that would be the "right" one for such a purpose, and I believe streamlink is the best home for such functionality out of all currently existing software. About the original issue, a platform I commonly record from that has discontinuities still gets completely recorded with streamlink, just in a format that is difficult to work with. I wonder if OP's issue has something to do with the recurring segment names that cause them to be treated as "duplicates" and thus skipped. If so, it could be possible to implement a flag that would disable such behavior, which would allow OP's issue to be fixed without addressing discontinuities in general. |
This isn't about whether Streamlink is the preferred tool for you or other people when recording streams. This is about technical difficulties which can't be overcome because of how Streamlink works as a simple, standalone HLS client and how external players have to read its output, as explained. Streamlink doesn't handle discontinuities "quite well", it doesn't handle them at all (because it can't), which leads to a broken output due to concatenating two or more completely different streams. Other applications then have to deal with that issue, be it a player, ffmpeg, an editing software, etc. In case of the There is no special issue with the HLS playlist posted in the OP. If you add the |
I understand the limitations you described. My original comment was moreso referencing the proposed solution of having the output file be split upon each discontinuity tag, which would be immensely beneficial for many users, even though as you say, streamlink's stated primary purpose is streaming, not recording. |
Well it's same problem when just playing the stream and a lot of free TV streams are using this now. |
This comment was marked as off-topic.
This comment was marked as off-topic.
That's because you're opening it with VLC that supports this. |
Checklist
Description
I'm trying to record an M3U8 stream from this page: https://www.wthitv.com/livestream/
Streamlink records the stream for some time, but then stops recording. When I look at the M3U8 source, I see in it EXT-X-DISCONTINUITY tags, and after each such tag, the TS fragments numeration starts again from "1". It looks like Streamlink stops recordings because of this.
Is it possible to add proper processing of this tag?
It's an example of M3U8:
The text was updated successfully, but these errors were encountered: