Sunday, September 20, 2020

Allow an OBS session to automatically control a second OBS

Had a situation where an OBS broadcast to YouTube with three OBS scenes, each with a different camera on a guest in our studio.  Along with the video cameras, OBS was displaying a PowerPoint presentations from a local computer, but also had occasions when users, via a ZOOM, needed to share their screen.

The product to YouTube is perfect, with presenters videos being shown on the screen, but since I had ZOOM users, I wanted their experience to be a familiar normal ZOOM meeting, with my 3 webthat they are used to, the web camera views showing my cameras along with all the other viewers who had cameras running.  I also wanted the screen share in ZOOM to be the same experience in zoom.  Meaning, I didn't want to share my cameras and presentation as one single share, the one that viewers on YouTube would see. 

So what I wanted was to have my 3 cameras (each on a different panel guest) being sent to ZOOM as a webcam automatically as I selected each of the 3 scenes, but just the webcam feed only, not any of the powerpoint or text or anything else.  And I needed it to happen automatically as I switched scenes.

SOOOO to solve it this way
tl; dr;
I set up 2nd computer and OBS instance with dedicated NDI feeds from each camera being send to the 2nd OBS.  Then used a remote control OBS app, a script in the 1st OBS that, upon selecting scenes would send a command to the 2nd OBS instance to switch to the matching scene that just had the dedicated feed of the appropriate camera.


Then on the FIRST OBS computer I installed this command line application.  It will allow you to send CLI commands to another OBS that is running WebSockets (remote control OBS app)

This allows you to change scenes on the remote computer using the command line.  The CMD sequence would look something like this to change scenes

OBSCommand.exe /server= /scene="SCENE_VALUE"


The NDI app for OBS was installed on BOTH computers.

On the first computer, each camera angle had its own separate NDI session that the the second OBS computer would receive.  This was configured in the EFFECTS FILTER on the primary OBS.


A script app was installed on the 1st OBS computer activates a script every time a certain scene was activated on the first BOS computer.  This calls the command line above to send a request to the second OBS computer

C:\Users\NAME\Downloads\OBSCommand_v1.5.3.+fixed_websocket\OBSCommand\OBSCommand.exe /server= /scene="SCENE_VALUE"

This command tells the remote system to change to "SCENE_VALUE" which is assigned in the variable in the script app.  So in the above example, "1" is the name of a scene on the second OBS computer, and "Safety" is the name of the other.

I setup a second computer running OBS.  And I installed "WEBSOCKETS" on it.  This program lets you control OBS from another device 


When I click on SCENE 1 on the First OBS computer, which has Camera 1 (+ data going to YouTube), it sends a command to the SECOND OBS computer to switch to its "Scene 1"...which contains ONLY the NDI feed of Camera 1 from the first OBS computer.

Make sense?  yea... i know.

THEN the second OBS computer output is saved as a webcam feed and goes to ZOOM.

I know craziness  but it works.

THEN on the SECOND computer you install the "VIRTUAL WEBCAM" output add on for OBS.  This will set the output of this OBS as a webcam that ZOOM will recognize as an input.

On my particular instance, my second OBS was running on a ZOOM ROOM computer

Make PowerPoint control other applications

 This will show you the basics (at least right now) of how to use PowerPoint to control other applications.

The basis of this code comes from Michael Kordahi's original post on his Linkedin account and OBS scripts page.  I found this very helpful and wanted to post how to do it, plus possible improvements.

Original post:

And Linkedin Post of an example:

How it works.

The VBA macro, when running in your PowerPoint slide looks at the first entry of the NOTES, parses it, and then sends a keystroke to another program based on the entry.

As you move through slides, it automatically reads it, and if a matching sequence is detected, it will send a command, in this example, to OBS to change camera angles automatically.

So, for example, in a worship situation, perhaps you want certain OBS scenes show be shown based on different powerpoint slides automatically.

Here's how to make it work.

Since this example will allow us to control OBS scenes, were going to use that

1> Create a 3 scenes in OBS

2> Set a hotkey for each one - CTRL+1 for scene1 CTRL+2 for scene2  CTRL+3 for scene3 etc.

3> Make sure that in OBS, when you press CTRL + number the scene changes.  

4> Create or load a powerpoint presentation.


6> in "macro name" call it   OnSlideShowPageChange

Then click on "CREATE"

You'll see this:

Sub OnSlideShowPageChange()

End Sub

7> Make it look like this:

Sub OnSlideShowPageChange()
Dim i As Integer
Dim sNotes As String
Dim sKey As String

i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
s = Left(ActivePresentation.Slides(i).NotesPage.Shapes.Placeholders(2).TextFrame.TextRange.Text, 4)

If Left(s, 3) = "OBS" Then
sKey = "^" & Right(s, 1)
AppActivate ("OBS")
SendKeys (sKey), 1
AppActivate ("PowerPoint")
End If
End Sub

8> You can "X" out of this and save the change.

9> Now in your presention "NOTES" put OBS1   or  OBS2   or   OBS3  on the first line.  This will correspond to the scenes.

10> Now start your PP presentation (F5) 

11> Make sure that OBS is running with your scenes, and change the slides in powerpoint, you should see the images change in OBS

(in some circumstances, you may need to "RUN" the macro manually to get it going, but normally, if you save the PP as a macro enabled file, when you load it, then you may need to goto

DEVELOPER-> Macro-> select macro and hit RUN