obs-websocket - Remote-control OBS Studio using WebSockets

obs-websocket - Remote-control OBS Studio using WebSockets 5.0.1

sqr

New Member
Hello guys, does anyone know if it is possible via obs websocket to change a source input value?

I have seen in the protocol.md that there is a SetSourceSettings, that has a request field called sourceSettings, but I don't know if that includes an Input field and if that could be changed.

The aim is to be able to change the HLS stream that is being used as a source, remotely.

Thanks
 

HisDivineOrder

New Member
I've been considering my alerts lately. Right now, I'm still climbing my way up to Affiliate and I'm very close now. Up till now, all I've needed was an alert for follow, host, raid, but mostly just follows. I figure once I hit Affiliate I ought to consider my alerts again. I noticed this while reading about ManVsGame's intriguing alert that changes his watermark from transparent to opaque, does an animation, and then goes transparent again...

"After a few failed attempts to “fake it” we finally decided that normal alerts just wouldn’t cut it. Froyd’s design, and the direction from MANvsGAME himself, dictated that we needed a way to interact with the watermark on-screen. Not only that, but also have some data that didn’t disappear after the alert was cleared. Websockets provided a simple way for us to tap into the data feed from StreamLabs. Tehkhop created a queue system and some amazing code that filtered the alerts and even brought in emotes in from the messages."

What's intriguing about his watermark is that it's constantly in motion. So it seamlessly goes from transparent to opaque while in motion, then transitions back. Lately, I've begun to wonder if they're probably doing an invisible scene swap with one scene being him with a transparent logo and then one scene with it opaque, everything else the same. Alerts must only happen on the opaque scene maybe?

Anyways, it got me to wondering if obs-websockets plus alerts can lead to alerts that control scene changes? Does anyone know if there's any code out there of someone doing that? You might do this to do some kind of color filter on yourself during an alert or something. I've done a google search and I can't see anyone even talking about using websockets in this way EXCEPT that original blog entry by NerdOrDie.
 

Palakis

Developer
Palakis updated obs-websocket - Remote control of OBS Studio made easy with a new update entry:

obs-websocket 4.5.1

Only use this release with OBS 22 or above!

4.5.1 bugfix release
  • Bugfix: plugin not loading on Ubuntu (misplaced binary)
  • Bugfix: improper control flow in filter management requests (missing return statements)
4.5.0 changes
  • New request types:
    • Filter management:
      • GetSourceFilters
      • AddFilterToSource
      • RemoveFilterFromSource
      • ReorderSourceFilter
      • MoveSourceFilter
      • SetSourceFilterSettings
    • Scene Items...

Read the rest of this update entry...
 
So the transparent logo going opaque and back to transparent is nothing new. Our custom written alert has a transparent "R&D" logo in the lower left corner that becomes opaque when a Sub comes in. Added to that, the R and D letters split apart, moving to opposite sides of the screen, revealing a "new / resub" message at the bottom center, then return to their normal positions and transparent at the end of the animation. Old example from a few years ago, quality is low, but it was the quickest clip of mine that I could find showing my alert : https://www.twitch.tv/robanddan/clip/FrailRichOrcaStinkyCheese

This is all done in CSS. The rotating ManVsGame logo "could" be a looping video file playing back in the HTML Browser Source, with its opacity being shifted in CSS. OR it could be made transparent via a series of calls to the obs-websocket plugin slowly adjusting an opacity setting in one of its source Filters. It all depends on which was more performant overall.

As for OBS-Websocket and Alerts controlling scene changes, this can 100% be done. Please look at these clips where I utilize obs-websocket and a tablet control panel to switch scenes, but also auto-enable a video of a lower third panel, which then disables itself shortly after it slides off screen, effectively resetting itself. The text and emote graphic are part of a browser source that also auto-populate the area with the appropriate information. https://www.twitch.tv/robanddan/clip/CrunchyFairPepperUncleNox

You also mentioned a "queue" system for alerts. Yep, done that too, using the Async.js library and its Priority Queue feature. https://caolan.github.io/async/docs.html


Different types of alerts have different priority levels. Priority Order is as follows...

1: Subs of all types (new, resub, gifts, etc). Raids, Large Donations, Giveaway starting trigger
2 : New Follow
3: Big Host (brings in 50% or more viewers than what the channel currently has. If we have 100 viewers and they bring in 50+ its a Big Host)
4: Small donation, StreamGifts purchase, Humble Bundle purchase
5: Smaller host (less than 50% of the current live viewer number)
6: Alert of a Tweet mentioning our Twitter account

This bundles up similar alerts so they all trigger one after another in order of priority, rather than handling them as they all come in, and puts the most important ones up front, and the not so immediate ones toward the back.
 

HisDivineOrder

New Member
So the transparent logo going opaque and back to transparent is nothing new. Our custom written alert has a transparent "R&D" logo in the lower left corner that becomes opaque when a Sub comes in. Added to that, the R and D letters split apart, moving to opposite sides of the screen, revealing a "new / resub" message at the bottom center, then return to their normal positions and transparent at the end of the animation. Old example from a few years ago, quality is low, but it was the quickest clip of mine that I could find showing my alert : https://www.twitch.tv/robanddan/clip/FrailRichOrcaStinkyCheese

This is all done in CSS. The rotating ManVsGame logo "could" be a looping video file playing back in the HTML Browser Source, with its opacity being shifted in CSS. OR it could be made transparent via a series of calls to the obs-websocket plugin slowly adjusting an opacity setting in one of its source Filters. It all depends on which was more performant overall.

As for OBS-Websocket and Alerts controlling scene changes, this can 100% be done. Please look at these clips where I utilize obs-websocket and a tablet control panel to switch scenes, but also auto-enable a video of a lower third panel, which then disables itself shortly after it slides off screen, effectively resetting itself. The text and emote graphic are part of a browser source that also auto-populate the area with the appropriate information. https://www.twitch.tv/robanddan/clip/CrunchyFairPepperUncleNox

You also mentioned a "queue" system for alerts. Yep, done that too, using the Async.js library and its Priority Queue feature. https://caolan.github.io/async/docs.html


Different types of alerts have different priority levels. Priority Order is as follows...

1: Subs of all types (new, resub, gifts, etc). Raids, Large Donations, Giveaway starting trigger
2 : New Follow
3: Big Host (brings in 50% or more viewers than what the channel currently has. If we have 100 viewers and they bring in 50+ its a Big Host)
4: Small donation, StreamGifts purchase, Humble Bundle purchase
5: Smaller host (less than 50% of the current live viewer number)
6: Alert of a Tweet mentioning our Twitter account

This bundles up similar alerts so they all trigger one after another in order of priority, rather than handling them as they all come in, and puts the most important ones up front, and the not so immediate ones toward the back.


Thanks!
 

Wutzmann

New Member
Have the plugin installed and configured.

How do I call the whole thing now from another computer in the Browser?
 

KenNics81

New Member
Hi, i can´t find any answer to the question "How to configure the obs-websocket plug-in to control obs from another network". I want to have access to serveral simple controls when i am not at my pc and NOT in the same network as my streaming computer?
It seems to be quite complicated...
 

Lanpingner

New Member
Hi, i can´t find any answer to the question "How to configure the obs-websocket plug-in to control obs from another network". I want to have access to serveral simple controls when i am not at my pc and NOT in the same network as my streaming computer?
It seems to be quite complicated...

Dear KenNics81
The answer for you question is much easier then you think You can simpily make a port forward on your router to access the OBS WebSocket from anywhere you want. When you are away from home, But if you are on the same network but in different subnet that can be a bit complicated. Please make sure you give a clear question soo we can help for you
 

Jaxel

Member
Does this not work with SSL?

I'm trying to set up a page on my server, which is behind HTTPS (SSL), and the websocket is rejecting the connection.
 

Jaxel

Member
I'm unable to get authentication working at all in my JavaScript.
I'm using the SHA256 library here: https://github.com/emn178/js-sha256
When authentication is required, it produces a prompt:
Code:
if (data['authRequired'])
{
    var pass = prompt("This OBS Websocket server requires a password:");
    
    if (pass != null)
    {
        var secret_string = pass + data['salt'],
            secret_hash = sha256(secret_string),
            secret = btoa(secret_hash),
            auth_response_string = secret + data['challenge'],
            auth_response_hash = sha256(auth_response_string),
            auth_response = btoa(auth_response_hash);
            
        
        args = {
            'request-type': 'Authenticate',
            'message-id': 'Authenticate',
            'auth': auth_response,
        };
        this.socket.send(JSON.stringify(args));
    }
}

However, I always get an authentication failed error in response.
What am I missing here?
 

KenNics81

New Member
Dear KenNics81
The answer for you question is much easier then you think You can simpily make a port forward on your router to access the OBS WebSocket from anywhere you want. When you are away from home, But if you are on the same network but in different subnet that can be a bit complicated. Please make sure you give a clear question soo we can help for you

I thought there is an easy way to access obs when i am away (over internet connection). For now i am using teamviewer to control OBS from my mobile phone when i am not at home.
Here is what i want to do:

I am livestreaming live music on youtube with my mobile phone. For the beginning i have a "Start Streaming" screen, an animated video with music and a countdown. Using a second iphone (lets call it iphone 2 ) i launch this countdown via teamviewer on OBS studio at home while i am on location already. During that countdown i get the stream started on my streaming iphone (iphone 1). When the countdown has finished i need to access OSB studio at home again to end the livestream there so youtube picks up the stream from my streaming iphone (iphone 1) that goes to the same rtmp adress. During the breaks i have a BrB sign setted up at home and an end screen. Both are triggered over teamviewer again. That moment i access OSB studio at home via Teamviewer on iphone2 and go live from there. After the stream has connected i end the livestream on my streaming iphone (iphone1) what makes youtube pick up the rtmp stream from OBS studio at home. So i am looking for a way to make all this easier.

I have tried several apps on iphone2 to stream those videos from location, but they always get stuck or the app crashes. Iphone 1 uses Streamlabs for Livestreaming, but the app cant play videos directly from the Iphone.
 

KenNics81

New Member
Dear KenNics81
The answer for you question is much easier then you think You can simpily make a port forward on your router to access the OBS WebSocket from anywhere you want. When you are away from home, But if you are on the same network but in different subnet that can be a bit complicated. Please make sure you give a clear question soo we can help for you

So i configured a virtual machine as streaming server using Nginx today. I can now stream video from my mobile phone to my private server that sends it out to obs at home. But still even i opened port 4444 on my router, on my pc and on the VM the remote isnt working... Connecting it directly to my pc works but as i do not have a static IP tomorrow it wont... Its so complicated and so much work... Why cant there be a simple tutorial ...??? ;)
 

Jaxel

Member
Got a couple of feature requests:
  • The contents of `Heartbeat` should be included in `StreamStatus`. StreamStatus is already being sent every 2 seconds, why enable a second trigger just to get that extra information?
  • The response from `GetSceneList` should also include the name of the scene collection itself.
 

jthorup

New Member
I'm getting ready to work with a coder on a custom interface for use with obs-websocket. I'm trying to determine if the websocket has access to the option "Fullscreen Projector"? I would like to create an interface that allows me to dynamically change what scenes are going to what display. I've only found one PDF, on the python implementation, that gives a list of available commands and calls.

Is there a list of available functions somewhere?

Thanks
 

Attachments

  • OBS_WS_External Monitor.png
    OBS_WS_External Monitor.png
    825.7 KB · Views: 283

Palakis

Developer
Palakis updated obs-websocket - Remote control of OBS Studio made easy with a new update entry:

obs-websocket 4.6.0

Only use this release with OBS 23 or above!

4.6.0 bugfix release
  • Revamped WebSockets server: the WebSockets server backend was completely rewritten. Instead of Qt's WebSockets library, starting with 4.6 obs-websocket now uses websocketpp by zaphoyd. Other benefits include:
    • Requests are received and processed in a separate dedicated threads. The old server processed everything in the UI/main window...

Read the rest of this update entry...
 

Palakis

Developer
Palakis updated obs-websocket - Remote control of OBS Studio made easy with a new update entry:

obs-websocket 4.6.1

Only use this release with OBS 23 or above!

4.6.1 Hotfix changes
  • Bugfix: TransitionBegin event not triggering at all
4.6.0 changes
  • Revamped WebSockets server: the WebSockets server backend was completely rewritten. Instead of Qt's WebSockets library, starting with 4.6 obs-websocket now uses websocketpp by zaphoyd. Other benefits include:
    • Requests are received and processed...

Read the rest of this update entry...
 

Jaxel

Member
stats['free-disk-space'] seems to have incorrect data. It's returning the value of the free space on my C: drive... even though my recording drive is Z:. The stat is shown properly in OBS itself, but not in the websocket.

Also, the numbers for output-skipped-frames and render-missed-frames don't always match up with what OBS is reporting.

Also, any word on SSL support?
 
Last edited:
Top