Jump to content

Live Stream Disconnect Handling


Theradioguy

Recommended Posts

Theradioguy

Hello all,

I recently started using Emby primarily for the purpose of streaming live TV to a number of Roku devices and I'm having some issues with how Emby handles unexpected disconnects from the streaming source.

Bit of background, I have a TVHeadend server in a remote datacenter which receives feeds from satellite and allows them to be streamed over the Internet as a MPEG transport stream.  I am using Emby to ingest the feeds and I typically watch them on one of a couple of Roku devices.  This setup works well most of the time time, however, if there is an issue with the feed (mostly due to Internet hiccups as the source is remote) I find that more often then not I will never be able to re-connect to the stream until the Emby server is restarted.  This situation only seems to occur when there is a problem with the feed, when I gracefully stop streaming on the Roku I am able to re-connect to the channel at a later time without issue.

When the issue is occurring, the Roku will typically stall out at a spinning wheel, or sometimes just a completely black screen.  I can then exit the Emby app, or 'go back' to the guide to regain control of the device.  The status page on the Emby dashboard does not show any active streaming clients.  When attempting to reconnect to the channel on the same or on any other Roku, I receive a red error message saying an invalid HTTP response was received.  Restarting the Emby server results in me being able to re-connect to the stream from the Roku.

My question, is there a way to force disconnect whatever process Emby has locked when generates the http error without restarting the server.  if the server is restarted then it can be disruptive to any other people potentially watching unrelated channels. 

Anecdotally I have also observed problematic behavior with over the air streams from my HDHomerun - it seems when there is an ungraceful disconnect of the stream (such as an issue with signal reception) the tuner is left locked open even though the client has disconnected.  I have not observed this problem as often (likely because the HDHomerun is on the same local network), but if there is a command I can run to unlock the tuners in this case it would be helpful as well.

Link to comment
Share on other sites

Theradioguy

Thanks for the response.  I have attached the emby server log file as well as the fmmpeg  transcode log which shows the issue.  I have also attached an older emby server log I had captured a few days ago after the same issue.  Let me know if you need anything else from me.

In the Emby server log, I can see right near the end where it starts to send `http/1.1 Response 500 to host2.` which I think is the crux of the issue.

Turns out this is really easy to replicate, simply by starting to stream a channel on a Roku device and then restarting tvheadend can result in this error 500 situation at least 50% of the time.

ffmpeg-transcode-74176492-51b6-4814-9d11-f256258a4083_1.txt embyserver (1).txt embyserver.txt

Edited by Theradioguy
Link to comment
Share on other sites

  • 2 weeks later...

Hi, can you try resetting these customizations and see if that helps:

>>>>>  Non-Default Encoder Parameters
Warning EncoderParametersH264LibX.Preset: Original: veryfast Actual: superfast

Thanks.

Link to comment
Share on other sites

Theradioguy

I have made the change and will advise if the issue reoccurs. Of note, this does seem to happen when using the official Emby Theater Linux client on Ubuntu as well, though not as frequently.

  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
Theradioguy

Indeed, this problem is still present in Emby 4.7.11 and version 4.0.75 of the Roku app.

I also observe this issue on the Emby Theater client for Linux, though it doesn't occur as frequently.  

Link to comment
Share on other sites

  • 1 month later...

OK, we are working on improving this and believe this should be resolved in the upcoming 4.8 server release. Thanks.

Link to comment
Share on other sites

  • 7 months later...
Theradioguy

So one workaround I have found is to go into the TVHeadend settings for the stream profile and set the data timeout to some value (by default it is 0 or infinite).  By doing this, if the stream drops then TVHeadend kicks Emby after the configured amount of time and you can then restart the stream on the Emby client.

I still think there are some improvements to be made with how to handle the disconnects on the Emby side,  but this workaround at least avoids the need to restart Emby whever a stream is lost while being watched.  Hopefully it helps someone else in my situation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...