Friday, January 31, 2025

Send commands to another OBS via Websockets

Why is there such poorly written non sensical information on how this thing works with its command structure.  Not that this document is any better, but I'll put what I know to make this work.

What I need is to use Advanced Scene Switcher to detect specific scenes are active, then send a command from one OBS, to another OBS computer using Websockets to deploy specific graphics.

For relevance of this description OBS 1 is the switcher and is sending video to OBS 2, the graphics machine.

I'm using Advanced Scene Switcher to monitor and detect for specific scenes to be active and then send web sockets to the other OBS when it detects it as active. 

Steps:

Make Websockets is active in your Second OBS.  Set a password and check the enable box.



In first OBS, create a macro in Advance Scene Switcher.

In this example, when first obs activates the "Replay" scene, Avance Scene Switcher detects this and will send a command to the second OBS machine to change to a scene on it caled "Replay" on that system.

This is what it looks like


This is the code that I used above if you want to copy / paste it.

You can change the word "Replay" in the code example to be one of your scenes on your SECOND obs. The request ID can be anything.  Its needed, but a debug purposes.

{
"op": 6,
"d": {
"requestType": "SetCurrentProgramScene",
"requestId": "12345",
"requestData": {
"sceneName": "Replay"
}
}
}

You can see that its sending the command to the Graphics Computer and in the icon when you add this feature you need to setup a connection.  This is what mine looks like.


Assuming you have activated the Websockets server in OBS on your second computer that will receive this commands, you should see "Connected and authenticated" displayed when you test the connection.


1 comment:

  1. Hi friend, could you make contact with me, to williams.cardona@gmail.com, we are from a church and need look something about OBS.

    ReplyDelete

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.