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

Retry after source offline or other network problem while recording #1146

Closed
porcomail opened this Issue Aug 5, 2017 · 5 comments

Comments

Projects
None yet
5 participants
@porcomail

porcomail commented Aug 5, 2017

Checklist

  • This is a bug report.
  • This is a feature request.
  • This is a plugin (improvement) request.
  • I have read the contribution guidelines.

Description

Could be a bugfix or a feature request...
Executing this command:

streamlink best -o output.ts --retry-open 1000 --retry-streams 10

I expected that, if connection goes offline while recording,
it attempts 1000 times with a delay of 10 seconds to reconnect before exit.

But instead, if while recording the connection goes down or the stream goes offline, streamlink says:
"Error when reading from stream: Read timeout, exiting". End it exits.

Expected / Actual behavior

If while recording/playing the source is no more available or there's some other network problem, would be good if streamlink wait X time to the stream to come back.

Reproduction steps / Explicit stream URLs to test

  1. streamlink http://www.ustream.tv/channel/live-iss-stream best -o liveiss.ts --retry-open 1000 --retry-streams 10
  2. disconnect your internet
  3. wait and see that streamlink doesn't perform retry but exits

Environment details

Operating system and version: Windows 10
Streamlink and Python version: Streamlink 0.7.0, Python 3.5.2

@bastimeyer bastimeyer added the question label Aug 5, 2017

@bastimeyer

This comment has been minimized.

Show comment
Hide comment
@bastimeyer

bastimeyer Aug 5, 2017

Member

This question is related to #1064 and #1108...

--retry-open and --retry-streams are only being used for initial requests to retrieve the stream data.

When trying to control the stream download process, you need to set the --stream-segment-attempts / --hls-segment-attempts and --stream-segment-timeout / --hls-segment-timeout parameters, which let you set the number of download attempts and time before giving up a single stream segment file.

The difference between these parameters is not that well documented though, and should be improved.

Member

bastimeyer commented Aug 5, 2017

This question is related to #1064 and #1108...

--retry-open and --retry-streams are only being used for initial requests to retrieve the stream data.

When trying to control the stream download process, you need to set the --stream-segment-attempts / --hls-segment-attempts and --stream-segment-timeout / --hls-segment-timeout parameters, which let you set the number of download attempts and time before giving up a single stream segment file.

The difference between these parameters is not that well documented though, and should be improved.

@porcomail

This comment has been minimized.

Show comment
Hide comment
@porcomail

porcomail Aug 5, 2017

Thank you @bastimeyer for the clarification, but it seems to not work the same. I tried with this command line, as you suggest:

streamlink http://www.ustream.tv/channel/live-iss-stream best -o liveiss.ts --stream-segment-attempts 1000 --stream-segment-timeout 10 --hls-segment-attempts 1000 --hls-segment-timeout 10

But when I disconnect my internet to test, it exits again after few seconds with the same error "Error when reading from stream: Read timeout, exiting". (Without showing any message about the waiting).

porcomail commented Aug 5, 2017

Thank you @bastimeyer for the clarification, but it seems to not work the same. I tried with this command line, as you suggest:

streamlink http://www.ustream.tv/channel/live-iss-stream best -o liveiss.ts --stream-segment-attempts 1000 --stream-segment-timeout 10 --hls-segment-attempts 1000 --hls-segment-timeout 10

But when I disconnect my internet to test, it exits again after few seconds with the same error "Error when reading from stream: Read timeout, exiting". (Without showing any message about the waiting).

@sou7611

This comment has been minimized.

Show comment
Hide comment
@sou7611

sou7611 Sep 15, 2017

seeing the same exact issue on current (0.8.1) version from multiples of sources (foxsportsgo, espn, etc) using m3u8 hlsvariant.

Runs fine for a bit, then abruptly exits with error reading from stream: read timeout

Seems to always happen after brief network interruptions (thank you Comcast)

The above referenced command line options make no difference in behavior.

sou7611 commented Sep 15, 2017

seeing the same exact issue on current (0.8.1) version from multiples of sources (foxsportsgo, espn, etc) using m3u8 hlsvariant.

Runs fine for a bit, then abruptly exits with error reading from stream: read timeout

Seems to always happen after brief network interruptions (thank you Comcast)

The above referenced command line options make no difference in behavior.

@back-to

This comment has been minimized.

Show comment
Hide comment
@back-to

back-to Jan 2, 2018

Contributor

@porcomail
for normal hls streams, you would need to change --hls-timeout

https://streamlink.github.io/cli.html#cmdoption-hls-timeout

but this won't work with the ustream plugin
because it's a special hlsstream that uses a api every 30sec to reload,
it can't handle it because there is no autoreconnect in the api poller.

Contributor

back-to commented Jan 2, 2018

@porcomail
for normal hls streams, you would need to change --hls-timeout

https://streamlink.github.io/cli.html#cmdoption-hls-timeout

but this won't work with the ustream plugin
because it's a special hlsstream that uses a api every 30sec to reload,
it can't handle it because there is no autoreconnect in the api poller.

@TheSneakySniper

This comment has been minimized.

Show comment
Hide comment
@TheSneakySniper

TheSneakySniper Jan 24, 2018

You can simply use a while loop.

TheSneakySniper commented Jan 24, 2018

You can simply use a while loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment