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

low latency #2847

Closed
deadkid14 opened this issue Mar 26, 2020 · 3 comments
Closed

low latency #2847

deadkid14 opened this issue Mar 26, 2020 · 3 comments
Labels

Comments

@deadkid14
Copy link

hi when i put my hls live edge all the way down to 1 I still see some latency between the stream on streamlink and the stream on twitch can someone please help?

@Joshfindit
Copy link

hi when i put my hls live edge all the way down to 1 I still see some latency between the stream on streamlink and the stream on twitch can someone please help?

Can you quantify how many ms you mean when you mention some latency?

@bastimeyer
Copy link
Member

@deadkid14 Your provided informations are very sparse...

You need to be running at least streamlink 1.3.1+51.geb72826. Then set the --twitch-low-latency parameter and check the log output whether it is actually a low latency stream on Twitch. This is not always the case and the streamer has to enable this.

https://streamlink.github.io/latest/cli.html#cmdoption-twitch-low-latency

If you've set the twitch low latency parameter, it'll automatically reduce the hls-live-edge parameter to a value of at most 2 and also sets --hls-segment-stream-data to true, so that HLS segments can be consumed by the player while they are being downloaded instead of having to wait for them to finish first. In addition to that, segments will be prefetched from Twitch and downloaded as soon as they become available.

Reducing hls-live-edge to 1 is the lowest latency you can have. However, the final output depends on your player and its own caching/buffering. As you can read in the parameter description, you'll have to set custom player parameters via --player-args or --player or configure your player manually.

If you're using MPV, which I definitely recommend, then you can play around with its cache related parameters. You will have to read the documentation for this and understand what each of these MPV parameters does.

Once you've found the right balance between low latency and stable caching, you'll see a lower latency than Twitch's website by one or two seconds. However, as said in the pull request of the twitch-low-latency feature, this all is not very optimal and you'll run into issues sooner or later, especially if a stream is not a LL stream and you're still applying aggressive caching settings.

@bastimeyer
Copy link
Member

how do you enable that in the streamlink twitch gui?

Not sure if deleting your comment and closing the thread means that you've figured it out, but in the Twitch GUI you can add custom streamlink parameters after you've enabled the advanced settings. Do that and add the --twitch-low-latency parameter. The live edge number field is down below. Then select the MPV player profile and add custom MPV parameters at the bottom if you need to, but make sure that you're using MPV's new parameter syntax, otherwise it'll fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants