Question / Help RTMP Restart Playback / Hide Source doesn't work simultaneously

whytheheckme

New Member
Hello,

FWIW, I tried this on the Mac version of OBS with the same result.
I'm trying to take in an RTMP source using Media Source into a scene, and when the RTMP source goes down, show a static image behind it. When the RTMP source comes back up, I want it to resume playing over the static image.

When configuring "Media Source" for my RTMP feed in OBS (let's call this OBS-overlay), I check both the "Hide source when playback ends" box and the "Restart playback when source becomes active" box. My RTMP source is an nginx/rtmp server, being fed by another instance of OBS (lets call this OBS-playback) (running either on the same machine or a different, same result.)

With only the "live on" option selected in my nginx server with the above Media Source configuration, when I cut the RTMP source (stop the streaming OBS-playback), the feed in OBS-overlay freezes and does not hide. However, when I resume the RTMP source (OBS-playback), the video on the Media Source on OBS-overlay does resume correctly.

With the option "publish_notify on" enabled on the nginx RTMP server, I get different results. When the playback is stopped on OBS-playback, the Media Source on OBS-overlay does indeed hide - however, when I resume the OBS-playback stream, the Media Source on OBS-overlay does not resume. The only way to get it to reliably resume is to open the Media Source options and press OK, which I assume restarts the source. Maybe switching Scenes would work too, haven't played around with this.

I can't seem to get both Media Source options working simultaneously. I've also tried adding all combinations of "play_restart on" , "idle_streams off" and "publish_notify on" - to no avail. Having any one of these present produces the conditions in the second example above (where Hide works but Restart does not.)

Does anyone have any suggestions on what to do to remedy this?

Thank you,
~whytheheckme
 

whytheheckme

New Member
Does anyone have any other suggestions, or perhaps an idea of a different place (either on this forum or elsewhere) where I should be posting to find ideas?

Thanks!
 

leex

New Member
I am trying to do exactly the same thing and can confirm the same problem when using "publish_notify on" - so thanks at least for showing me how to let OBS know the stream has finished.

What I know:

"Hide source when playback ends" was initially an option for loading a file and with this option checked, instead of showing the last video frame of that file OBS will hide the source. This works the same with a stream with "publish_notify on" HOWEVER there is a bug with this where the visibility icon stays on, even when it's off, which is why turning it off then on again resumes the stream (it is actually off). Furthermore keep in mind this is not the setting we are both probably looking for which is more like "When playback ends, insert a transparent frame." (I'm not sure about you but I don't want the source hidden because then I have to unhide it next time playback from the stream resumes).

I don't have anything further to offer than that but thanks for your help - maybe we can work it out together.
 

leex

New Member
whytheheckme I have found a way to do it!!

I have two instances of obs, the primary is streaming to youtube and the secondary setup to stream to an element on the primary. When I start the secondary screen it is presented in the primary OBS and when I stop the primary screen is disappears from the element in the primary OBS - I can then restart the secondary stream and it will reappear on the primary OBS.

I do this buy running detecting when the stream from the secondary OBS has stopped and I send another stream which has a green picture which I filter out with chroma, so the image is technically still there on the primary OBS but cannot be seen - that greenstream runs for about 10 seconds then stop - I can then run another stream from the secondary OBS and it will overwrite the greenstream.

Anyway, there are a couple of bash scripts and a lot was learned, I'm happy to tell you how if you want to know!! I'm very excited!!!
 

Ruhrev

New Member
leex, and everyone else seeing this!

After more than a year, have you found out a "better" way of doing this? I just can't seem to find a proper way of doing this - without doing the whole primary and secondary screen thing (thanks for that btw).

But yeah.. I just can't get over it. I really want a more proper way of going about it. Media Source to be hidden when nothing is streamed through it (rtmp, srt etc). And to AUTOMATICALLY come back on, when media is being streamed through Media Source again.

As for now (with "publish_notify on" in Nginx), Media Source will "hide" when the rtmp shuts down, showing the layer underneath Media Source - which is great! But when the rtmp stream is up again, Media Source will not automatically unhide/show again. So I have to constantly go and hide and unhide the source for it to refresh again.. it's quite annoying, since I'm doing all of this when I'm outdoors IRL streaming. Websocketing OBS and using Remote OBS works, and makes it a bit easier to make this work. But the fact that I have to constantly hide/unhide the source for it to refresh is just quite annoying.

Is there another way now?

Thanks! :)
 
  • Like
Reactions: kam

Carlo5G

New Member
You can use "on_publish" and " on_publish_done" in your nginx rtmp config and call a simple script that uses the OBS-Websocket-API.
It's an easy way to automatically hide/unhide the source or change the scene.
 
Top