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

SRT streams have trouble connecting/reconnecting while Recording is running #4596

Open
loopy750 opened this issue Apr 25, 2021 · 25 comments
Open
Labels
Confirmed This bug report has been confirmed by project members

Comments

@loopy750
Copy link

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

27.0.0-rc2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/YvNqZDkccJqVfIK-

OBS Studio Crash Log URL

No response

Expected Behavior

Streams should be able to reconnect without issue.

Current Behavior

SRT stream from Larix on Android fails to reconnect when stopped while OBS is recording.

Steps to Reproduce

  1. Open OBS with Media Source containing SRT URL.
  2. Launch external stream app, and start recording in OBS
  3. Restart stream. Won't reconnect.
  4. Stop recording in OBS. Stream will instantly reconnect.

Anything else we should know?

Interestingly with 26.1.1 it has a hard time reconnecting regardless of recording status. So SRT stability has improved in v27, but still not 100%. (Opinion: as SRT is all about providing stability and a robust stream under any circumstances, hopefully this and any other stability related issues can be resolved, else users might not trust being able to leave OBS/SRT unattended.)

@pkviet
Copy link
Member

pkviet commented Apr 25, 2021

Try to add this to your Media Source URL in obs:
?mode=listener&listener_timeout=5000000&timeout=5000000

@loopy750
Copy link
Author

Try to add this to your Media Source URL in obs:
?mode=listener&listener_timeout=5000000&timeout=5000000

Thanks for the suggestion but unfortunately it doesn't help. Also I think you meant listen_timeout, but either way, no go.

Although, I can say that timeout=5000000 may have helped somewhat, as there are times it will reconnect, but more often than not, I can have it recording for several minutes while it's trying to reconnect, but only after I end the recording, the stream is able to then reconnect.

So even though it's doing something, it's definitely not a 100% fix for this issue.

@kpcenti
Copy link

kpcenti commented Apr 28, 2021

I have the same problem even if I'm recording or not.

@pkviet
Copy link
Member

pkviet commented Apr 28, 2021

Did you try what I suggested above @kpcenti ?

@kpcenti
Copy link

kpcenti commented Apr 29, 2021

Yes I have, it's better but still has the problems from time to time. I also tried it on the newest RC version and it's the same

@HyperVolcan
Copy link

This issue still exists SRT stream cannot reconnect if connection is lost while OBS is recording

@RytoEX RytoEX added the Confirmed This bug report has been confirmed by project members label Nov 12, 2021
@RytoEX
Copy link
Member

RytoEX commented Nov 12, 2021

I can confirm this issue on OBS Studio 27.1.3 on Windows. The Steps to Reproduce must be performed in exactly the order specified, and the active output must be recording. This does not seem to occur with an active stream or virtual camera.

@DiegoTS55
Copy link

DiegoTS55 commented Dec 1, 2021

Hello,

same reconnecting issue.

Here my config:

OBS Studio 27.1.3 (64 bit) running on macos 11.4 ( Intel processor)
Larix Broadcaster Version 1.1.18 build 251 running on iPhone 13, ios 15.1.1

OBS Settings:

Media Source input
srt://XXX.XXX.XXX.XXX:XXXXX?mode=listener
Network Buffering 2 MB
Reconnect Delay 1Sec
all other options de-flagged

NO recording
NO streaming

Issue:

if transmission is interrupted the displayed image on OBS freezes. After exactly 60secs it restarts automatically.
During these 60 secs Larix Broadcaster keeps the transmission alive sending data, on OBS the image remains freezed; at the end of the 60 secs it seems the connection/trasmission is interrupted and Larix Broadcaster reconnects again to OBS and then srt is displayed correctly.

Tested with different srt parameters( as the "timeout" ). Sometime works better but it is not consistent and I do not understand which parameter/parameters changes the relation.

It looks like an OBS related issue.

Any suggestion is very appreciated.

Thanks.

@DiegoTS55
Copy link

DiegoTS55 commented Dec 2, 2021

Hello,

same reconnecting issue.

Here my config:

OBS Studio 27.1.3 (64 bit) running on macos 11.4 ( Intel processor) Larix Broadcaster Version 1.1.18 build 251 running on iPhone 13, ios 15.1.1

OBS Settings:

Media Source input srt://XXX.XXX.XXX.XXX:XXXXX?mode=listener Network Buffering 2 MB Connect Delay 1Sec all other options de-flagged

NO recording NO streaming

Issue:

if transmission is interrupted the displayed image on OBS freezes. After exactly 60secs it restarts automatically. During these 60 secs Larix Broadcaster keeps the transmission alive sending data, on OBS the image remains freezed; at the end of the 60 secs it seems the connection/trasmission is interrupted and Larix Broadcaster reconnects again to OBS and then srt is displayed correctly.

Tested with different srt parameters( as the "timeout" ). Sometime works better but it is not consistent and I do not understand which parameter/parameters changes the relation.

It looks like an OBS related issue.

Any suggestion is very appreciated.

Thanks.
Well, continuing testing.

Here some other observations

in OBS sorce input "media source" settings:

a) Media Source input
srt://XXX.XXX.XXX.XXX:XXXXX?mode=listener
Network Buffering 2 MB
Reconnect Delay 1 Sec
all other options de-flagged

If SRT stream is interrupted the displayed image on OBS freezes. Restart Automatically after 60 secs

b) Media Source input
srt://XXX.XXX.XXX.XXX:XXXXX?mode=listener
Network Buffering 2 MB
Reconnect Delay 15 Sec
all other options de-flagged

If SRT stream is interrupted the displayed image on OBS freezes. Restart Automatically after 75 secs

c) Media Source input
srt://XXX.XXX.XXX.XXX:XXXXX?mode=listener
Network Buffering 2 MB
Reconnect Delay 30 Sec
all other options de-flagged

If SRT stream is interrupted the displayed image on OBS freezes. Restart Automatically after 90 secs..
It looks like that the Reconnect Delay Slider default time of 1 sec is wrong because it correspond to 60 secs.

Please verify on your configuration if you can reproduce.

Thanks

@kamileq
Copy link

kamileq commented Jan 10, 2022

I have the same issue on OBS 27.1.3 on macOS like DiegoTS55. Using SRT Listener is unreliable in such condition. I found solution:
a) using SLS localhost server on macOS
b) using OBS in Windows 10 - much more stable option
c) using OBS in Windows 10 and SRT Mini Server - very stable option but then canNOT use Loopy SRT Stats Monitor

@pkviet
Copy link
Member

pkviet commented Jan 25, 2022

i've repro'd with OBS 27.2 beta 4. I'll investigate.
edit: since rist and srt are close in terms of their implementations and are supported by Larix broadcaster, out of curiosity, I tested rist but i couldn't repro the bug. So it seems really it has to do with srt streams.

@pkviet
Copy link
Member

pkviet commented Jan 25, 2022

it seems I get the issue too when I stream.

@robotmay
Copy link

robotmay commented Jan 26, 2022

Can confirm this myself and that Larix broadcaster isn't the issue - I have an SRT relay in between the two and the logs reflect that OBS takes roughly 60 seconds to reconnect once the stream drops. It doesn't seem to be related to any output from OBS as it happens when not streaming/recording too.

Edit: it definitely seems to be something around OBS not retrying the stream. If you start up the SRT stream, let OBS connect, then stop the stream in Larix, then wait a couple of minutes and start it back up again, OBS will connect immediately (i.e. within the 1-2 seconds I'd expect with a reconnect delay of 1s). So it seems to be some sort of delay on it recognising that the stream has dropped, rather than the reconnect delay? 🤔

@robotmay
Copy link

robotmay commented Jan 26, 2022

Ah ha! It's the network buffering setting. If you set it to 0MB it drops and reconnects almost immediately. However this doesn't seem to work unless you have a relay in the middle.

@Lampburner
Copy link

This seems to still be an issue in OBS 27.2.3. SRT streams from Larix Broadcaster will not reconnect in OBS while I am recording locally.

@RytoEX
Copy link
Member

RytoEX commented Nov 16, 2022

Does this still occur in OBS Studio 28.1.2 (or newer)?

@Lampburner
Copy link

Lampburner commented Nov 17, 2022 via email

@jackhilo
Copy link

I have attempted to use the solutions in this thread and will say it is still a present issue; I am currently unable to re-connect when recording and have not been able to successfully reconnect once in OBS 29.0.0 it's very sad to see this is just going untouched as Local OBS recordings are my primary way to save videos to edit later.

@zdnguyen
Copy link

Also on OBS 29.0 having the same issues. SRT from LAN will occasionally reconnect while recording from Larix/IRL pro, but on a different network it has 0 success trying to connect or reconnect while recording.

@alexandre-leites
Copy link

I also have this issue. Reconnection do not work until I stop recording.

@pkviet
Copy link
Member

pkviet commented May 13, 2023

here's a workaround:

  • set Media Source to be a caller
  • set Larix to be a listener
  • reconnect then works even when recording.
    I investigated a bit and the issue the other way around seems related to a bug in FFmpeg where the srt socket is not released when there's been a disconnection.
    How the hell having a recording achieves that, I have no idea. It's very very weird.

@loopy750
Copy link
Author

Coming back to this, I wasn't able to reproduce it, then I realised why.

set Media Source to be a caller
set Larix to be a listener

I couldn't get it working by reversing the caller and listener, but I worked out what my unintentional workaround was:

Create a scene, call it "Dummy SRT" or whatever, and add a Media Source with a port you won't use, eg: srt://127.0.0.1:60000?mode=listener. All boxes are unchecked but I don't know if that makes a difference.

Now Recording has no effect.

@pkviet
Copy link
Member

pkviet commented May 15, 2023

@_@ weird. I'd rather have this bug solved. I wonder if an srt update might help. Anyway, if you can live with this workaround for the time being, that's good.

@loopy750
Copy link
Author

I completely agree, I'd rather see the bug sorted. That being said, if my (or your) workaround works for others, then it's as good as a bug fix, at only takes a few seconds to apply.

@richtopia
Copy link

This issue persists in 30.2.2. I'm commenting here for anyone else searching for a work around: I run a Mist Server (https://mistserver.org) on my PC with OBS to ingest the SRT stream and rebroadcast as an MP4 html5 video. A bit convoluted and induces some latency, but it does handle reconnects without issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed This bug report has been confirmed by project members
Projects
None yet
Development

No branches or pull requests