Shut down OBS (Exit) via Websocket

SonnyWalkman

New Member
Can a method be added to WebSocket's API to shutdown OBS gracefully? Gracefully, I mean if OBS is actively streaming and recording the need to stop both prior to shutting down OBS. There have been a few requests however, I feel it's not a hard one to address for people similar to myself using scripts to do stuff with OBS minimised.
Cheers
 

AaronD

Active Member
The Advanced Scene Switcher plugin can do that:
1689266651059.png

The shutdown at the end pops up a confirmation dialog, to give the local user an opportunity to cancel. If no response for 10 seconds, it closes OBS.
 

SonnyWalkman

New Member
Thanks AaronD,
I try it out, I was after a more direct way of shutting down without loading another plug in.
Thanks for pointing it out. Didn't know "Shut down OBS" was a property. I suppose it's not visible to Websocket API.
 

AaronD

Active Member
...without loading another plug in.
I use that one a LOT!! You might come to like it too. It's an automation hub that can do almost anything in response to almost anything.

Didn't know "Shut down OBS" was a property.
It's a fairly recent addition, in response to my asking for it to use in my rig. If there's something you'd like to see added to it too, the developer is amazingly responsive in the plugin's discussion thread:
 

SonnyWalkman

New Member
Great,
I've made a donation probably a few more times.. Great work and amazing program.

There is one thing actually two?
1. Now most of us have hardware decoding/encoding setups. NVIDIA etc.. Could we get the GPU % put down on the status bar next to CPU % and add GPU % to the stats via WebSockets?
2. Add facility to Custom recording setup able to add meta such as '-service_name' for mpegts container for us whom steaming using UDP to other applications.
 

SonnyWalkman

New Member
Hey AaronD,
I forgot to ask, can advanced scene switcher able to play audio wav files into OBS like a one-shot approach? Like for a stinger "plays" then the audio file seeks to start ready to shine again.
I'm using the soundboard plugin to do it however, this plugin for some peculiar reason breaks when used in conjunction with GDI text scroller on the DSK plugin? I've lodged a bug with the developer.

Have any ideas of how to do this with script. I'd like a lua or python script approach if possible, however, if advanced scene switcher is able to do it that's also fine.
 

AaronD

Active Member
can advanced scene switcher able to play audio wav files into OBS like a one-shot approach? Like for a stinger "plays" then the audio file seeks to start ready to shine again.
Several ways to do that:
  • Have the WAV file already in OBS as a source somewhere, and have Adv. SS start that.
  • Have the WAV file in an external player, that waits for a websocket message to start playing.
    • Node-RED comes to mind for that. If Adv. SS can automate OBS for free, then Node-RED can automate everything else outside of OBS for free. And NR can even have a custom-designed user interface that runs in a web browser, which means that your phone, tablet, old laptop, or whatever has a browser can have your custom buttons and indicators on it.
  • Have the WAV file simply accessible somewhere, and put a command in Adv. SS's Run action to play it. You need to understand the command line to make this work, as that's exactly what the Run action is.
I actually combine the last two in one of my rigs, though not with NR anymore. The player is MPD on a different machine, and Adv. SS's Run action calls a command-line controller for it:
sudo apt install mpd for *buntu, to get the player (server) itself. Network control only, which could be on the local machine or a different one, but regardless, it has no user interface of its own. It requires a controller (client) of *some* kind.
sudo apt install mpc for *buntu, to get the command-line controller (client) to put in the Run action. Other OS's will need something different.
sudo apt install gmpc for *buntu, to get a graphical controller (client) that looks and acts a lot like a media player itself, except that it's only controlling the server, not playing directly from itself.
 

norihiro

Member
I have created a plugin that does shutdown through obs-websocket. I hope this would be suitable.

By the way, on Linux and macOS, you may just send SIGINT so that OBS will terminate cleanly if recording, streaming and virtual camera are all stopped. SIGINT does not require my plugin nor obs-websocket.
 

bagheera1770

New Member
I have created a plugin that does shutdown through obs-websocket. I hope this would be suitable.

By the way, on Linux and macOS, you may just send SIGINT so that OBS will terminate cleanly if recording, streaming and virtual camera are all stopped. SIGINT does not require my plugin nor obs-websocket.
After scrolling through a dozen pages a simple SIGINT did it for me. Thanks a tonne!
 

tomdevlive

New Member
Advanced Scene switcher is cool, but its pretty noisy contstantly running checks. I get it though, the plugin kind of needs to do that in order to act on all the different things. If you want a simple shutdown then I reccomend norihiro's plugin. Advanced Scene switcher is too bloated to justify using it for a simple shutdown.
 
Top