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.

FULL STORY

STEP 1>
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=192.168.2.44:4445 /scene="SCENE_VALUE"


STEP 2>

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.



STEP 3>

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=192.168.2.44:4445 /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 




SOOOO

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 using VBA

Here's some code that will let you use PowerPoint to run .BAT files 

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.  I'm using it to control scenes in PowerPoint, but I've modified the code to use websockets.

Original post:
https://obsproject.com/forum/resources/powerpoint-slide-window-navigation-using-obs-hotkey.938/

And Linkedin Post of an example:

https://www.linkedin.com/posts/michaelkordahi_obs-streaming-virtualevent-activity-6698929041849880576-luhV/

I've modified Michael's code slightly from above, as I want it to call a .BAT. (his sent CTRL+ hotkey commands which also worked, but I needed to run power point from a different computer so i needed change it slightly)

In my case, I'm running PowerPoint, and as I advance slides, I want it to automatically send a command (via .BAT) to OBS Studio running on another computer, and I'm doing it in conjunction with WebSockets

https://obsproject.com/forum/resources/command-line-tool-for-obs-websocket-plugin-windows.615/

So here is what happens.

As the slides advance, based on the FIRST line of text on the "Notes Description" on the PowerPoint slide, that will trigger the execution of a .BAT file.

This bat file sends a command to the computer running OBS to switch to a specific scene.


Diagram, PowerPoint has "OBS3" for a description.  Sends that to the OBS computer, which triggers a scene to automatically be displayed.


Now as I advance through PowerPoint, specific scenes will automatically occur.  I use this in a house of worship situation where I want to reduce the load of the worship team.


Here's how to make it work.

First install the WebSockets app on your OBS computer.  You'll also want to install it on PowerPoint computer (assuming they are different machines).  



A suggest program to also install is NOOBS https://obsproject.com/forum/resources/nuttys-official-obs-commander-noobs-cmdr.1178/  which will greatly aid in the creation of the .BAT script for you.


EXAMPLE:

OBSCommand.exe /server=192.168.2.201:4444 /password="password01" /scene="PowerPoint Full Screen (1)"

4> Create or load a PowerPoint presentation.

5> Goto DEVELOPER -> MACROS 

or
VIEW -> MACROS

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)
Shell ("CMD.EXE /c C:\OBSCommand\" & sKey & ".bat")

AppActivate ("PowerPoint")

End If
End Sub

8>  Please note the C:\OBSCommand\ should reflect the path that you are storing your BAT files in for this.

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

In the example below, I have "OBS3" which, in the case of the example, the white screen on the left, when power point displays it, will call to run a bat file for "OBS3"


In this example, the script will check the first line for it to begin with OBS, then it will take the trailing number, which will be a "3"

10> now Launch NOOB

I've put in my server IP of my OBS box, I've put in the port and password.  Now click on the left most button "Not Connected" to imitate a connection


If successful, you should be able to now click on "SCENE" and then in the box next to "Switch To" you should be able to see all available scenes.


Once you have selected a scene, you can run "TEST COMMAND" and, if everything is configured, your scene should change in OBS.

Now export that command, and save it with a value of 1-9, in my example I saved it as "3"

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