Monday, February 3, 2025

Websockets using OBSCommand

Send commands to Websockets using OBScommander

So I'm using my goto program

obs-websocket - Remote-control OBS Studio using WebSockets | OBS Forums

Which generates the codes via a batch file in windows.

I got this solution running in 10 minutes

Situation:

Covering a sports event with OBS and need a clean feed (no graphics) sent to stadium LED wall but also a broadcast feed that has all my graphics.

To address this, the OBS switcher sends its output (no graphics) to the LED wall and also to a second OBS computer that does the overlays and also streams the video.

BUT

to add a bit of complexity, I want the score/clock graphics to be removed automatically when I key up an instant replay, so that stream viewers don't see that during replay.


1: So what I did was activate websockets on the graphics OBS, set a password.  I used "Password20"


2.  I setup two scenes
    
    One is called "Game" and this is the normal game.  Which contains the HDMI input from the switcher and the graphics overlay

The second one is called "Replay" which doesn't have any graphics, just the HDMI input


Now I installed 
obs-websocket - Remote-control OBS Studio using WebSockets | OBS Forums

(at time of writing it was version 5.0.1)

I also installed had to install the .Net 3.1 runtime for 
Download .NET Core 3.1 Runtime

There were a couple to select form Run console apps

Once that was installed I created 2 .BAT files in the directory that I extracted websockets remote control directory.  In my case, I put it in C:\OBSCommand_1.6.3


Using notepad I created 2 files.  

graphic-off.bat   contains this:

OBSCommand.exe /server=IPofGraphicsOBS:4455 /password="Password20" /scene="Replay"

graphic-on.bat   contains this:

OBSCommand.exe /server=IPofGraphicsOBS:4455 /password="Password20" /scene="Game"



4.
Now on my OBS instance running as a switcher, I installed 
Advanced Scene Switcher

This program does a bunch of tasks with OBS, but one of the ones I really like is that it can be used to detect when I trigger the instant replay scene, and send an approriate command to the graphics computer to turn the graphics on or off.

Once you install it, go into that OBS instance and we'll configure it.  On my switcher I have 2 camera inputs and a Replay input from our instant replay machine.


I started up Advanced Scene Switcher to make it active


On the Macro tab I created a new macro and this is what the configuration is:

The first macro, when it detects that the "Instant Replay" scene is live, will run the "graphics-off.bat" file, which will tell the graphics computer to switch to the scene with no graphics.




Then created a second one, this time we select "IF NOT" in the first section.
This says "if the active output is NOT instant replay, send a command to turn the graphics back on."



Now you can toggle back and forth between your scenes and graphics will turn on  and off.



No comments:

Post a Comment

Feel free to leave a comment! If you have any information that you think should be included, please do so here and I'll get it added in.