Is it possible to switch sources automatically?

crisbr002

New Member
Hello, does anyone know if it's possible to automatically play a video as soon as OBS starts and then have OBS switch to the capture source after the video ends?

The idea is to schedule OBS to start streaming and recording at a specific time with the video source playing, and then switch to the capture card source after the video ends and continue normally until the end of the live stream.

Currently, it's automated without the introduction video part. Would it be possible to do it the way I'm proposing?

Thank you!
 

Lawrence_SoCal

Active Member
I used Advanced Scene Switcher
Have a scene with the video, using AdvSS switch to other scene (and whichever desired sources) when video ends

For security reasons, I use a non-persistent stream key, so I have no need or reason to automate starting OBS, selecting a specific scene, starting streaming/recording, so can't help you there.
With that said, I would log into my CDN, grab appropriate scheduled video stream key and copy into OBS Studio. I then started stream when convenient (required to start in advance, not Public/Live). Using AdSS features, I automated switching to the starting scene at a selected time, started Recording, changed scenes, etc. I also programmed an ending sequence. As my use case is more interactive, I also use the Media Controls plugin so I can see time remaining on a video
 

AaronD

Active Member
I second @Lawrence_SoCal

Start OBS early, without automatically streaming, and have an Init macro in Adv. SS that runs once on startup. This macro sets up everything, in case OBS was shut down weird and remembered that. It does not start the stream yet. The condition for that macro is "Plugin Running", which is always true, with the "only on change" box checked, in the header above the conditions.

(I *always* have the "only on change box checked, because all of my automation needs to run exactly once when its conditions are met. If you have something that needs to be enforced constantly, then you might leave it unchecked.)
1682539232092.png

I haven't shown any Actions for this one, because it depends completely on your rig. See the bottom of this post for an overview of what you can do. (it's a lot!)

Another macro has a Date condition, for the time that you want to start streaming, and of course it does exactly that.
1682539258446.png

Either in the Stream Start macro before the actual start (as shown), or in the Init, I would set up a static scene for it to start streaming with. Then soon after the stream starts (1 second as shown here), switch to the video scene that you actually want to start with. You can do the "soon after" part with a Wait action in the Stream Start macro (as shown), or with a condition timer in a third macro. The difference is that you can cancel a condition timer by making the condition not true, whereas you can't cancel a Wait action.

Yet another macro looks for the video playing and less than X time remaining, and switches to the following scene with a transition that takes almost X time, but not quite. This is much more professional-looking than waiting for the video to finish *completely*.
1682539345957.png

(I just realized that you probably don't want "Previous Scene" for this, but I've already torn down my Sandbox rig. There's enough above that you should be able to figure it out though.)



I have a similar set of automation in one of my rigs, to set up the 15-minute leader and start, manually trigger the Welcome video because we don't keep *that* tight of a schedule, and automatically end up on a wide-shot camera. From there, it's manual until the end, where another set of macros takes us automatically from the Goodbye scene for 30 seconds, to a 10-minute trailer so people can disconnect before getting kicked off, and automatically stops the stream.

A minute after the stream stops, the Run action calls an external one-liner script that I wrote that closes OBS, so people don't play whack-a-mole trying to close multiple windows and mess up the next workflow in the process.
1682539524419.png

This also shows the condition timer that I realized I didn't show before.



The available Conditions and Actions are:
1682539815749.png
1682539755688.png

and you can use boolean operations too, like AND, OR, and NOT, to further refine the Conditions.

In a different rig, I use WebSockets - both Action and Condition - to coordinate two different instances of OBS on the same machine...
 
Last edited:
Top