datarhei / core

datarhei Core is management for FFmpeg processes without development effort. Whether your streaming has one viewer or a million, we have the tools to help you develop, deploy and manage any video project at any stage. We've solved the challenging problems so you can focus on your application, not your infrastructure.
https://docs.datarhei.com/core
Apache License 2.0
180 stars 41 forks source link

Streaming from Larix with fluctuating network coverage causes freeze even though data still comes in #15

Closed DJGummikuh closed 4 months ago

DJGummikuh commented 12 months ago

Hey! First of all, I don't really know if this is even a Restreamer Issue, however I have debugged as good as I could and turned up nothing nowhere, so this is a bit of a desperate shot into the blue.

We are trying to do a Stream from a Cellphone running Larix, via Restreamer to OBS. The cell coverage is very inconsistent, which causes the stream to lock up frequently as soon as the link goes down a bit. However, I'm monitoring the data traffic on the restreamer server and it turns out that, even though the data traffic recovers shortly after the dip, the stream stays frozen on the same picture. I have reconnect on 5 seconds and removal of stale connections on 10, but this does not fire, since traffic is continuously coming in (I assume). Larix is also reporting that it is still sending, therefore not degrading quality - but the picture stays frozen and no sound is present either. It looks as if after that freeze occurs, all the incoming traffic is still restreamed (input data rate equals output data rate on restreamer), but is simply discarded both in restreamers webplayer and my OBS video source.

The transmission is done using SRT. Bandwidth and Keyframe/B-Frame settings don't appear to have any effect here.

I do not have logs I can explicitly tie to these events (since we were trying out a lot of things).

Edit: We are independently approaching Larix with essentially the same question.

DJGummikuh commented 11 months ago

We did some more analysis and it seems the issue is really something around Restreamer. I replaced Restreamer with srt-live-transmit in minimal configuration srt-live-transmit srt://:1234 srt://:4201 and could not reproduce the stream hanging. I tried it by wrapping my phone in aluminum foil while streaming, which made the bandwidth collapse momentarily. With restreamer, after unwrapping I jumped back to normal bandwith but nothing was received. That state was preserved until I hit "stop" on larix, which resulted in a momentary noise while the stream shut down. Starting again caused the stream to be receivable again from Restreamer. with srt-live-transmit, transmission was immediately recovered. No restart was required in larix.

ioppermann commented 11 months ago

There has recently been a fix to the SRT library (datarhei/gosrt) that might be related to the behaviour you describe. The updated is not yet imported into the Restreamer Core.

This also seem related to #8

DJGummikuh commented 11 months ago

is there a way for me to splice the SRT Library into Restreamer without too much effort? Then I could try that out and report back here.

ioppermann commented 9 months ago

The datarhei/core:dev Docker image contains the latest update of the SRT library. Start this image up the same way as you would the Restreamer image and use our hosted UI to connect to the Core, e.g.:

https://demo.datarhei.com/ui/?address=http://127.0.0.1:8080

ioppermann commented 4 months ago

A fix is already available in the official releases.