JurgenW
New Member
I've been looking around for a while to find a way that would allow me to do something like what a Stream Deck does (but just without the cost of it).
Hotkeys in OBS have their limitations:
I'm not a programmer, although I can cobble together some simple scripts. What I've managed to figure out is a simple (?) way to use a joystick (or gamepad?) as scene switcher. This is pulled together from other bits that others have done so full credit to them. With some help this could probably be easily made into something more slick. The bits I'm using are:
The advantage of using a joystick as input are:
The way that I done this is with a simple AHK script that triggers on a joystick button and then calls a command line to OBS to change the scene:
Prerequisites are OBS Websockets installed and running, the Command Line tool downloaded and extracted to a folder of your choice (from the above, on my machine this is in "C:\OBS Streaming Service Folder\OBS Command Line\") and Autohotkey installed. I haven't set any security/password on my websocket connection as I'm running it on the same machine, I'm sure it would be trivial to add that into the command line tool.
The manual thing is to know what your OBS Scene names are (case sensitive!) and then just add line to the script for as many joystick buttons and/or scenes as you need. I hope this is useful to someone.
Things that I think could fairly easily be improved upon:
I managed to cobble this piece of AHK script code together that gets the list of scenes from OBS, but it is json format so I'm trying to parse that at the moment:
Maybe someone could help to develop this?
Hotkeys in OBS have their limitations:
- You have to choose keys that don't interfere with anything else
- Using a keyboard for hotkeys means you have to remember which keys are for what (not easy to label them)
- OBS doesn't seem to support F13-24 keys too well (plus you then need a keyboard that can generate them)
- OBS doesn't support joystick/gamepad buttons
I'm not a programmer, although I can cobble together some simple scripts. What I've managed to figure out is a simple (?) way to use a joystick (or gamepad?) as scene switcher. This is pulled together from other bits that others have done so full credit to them. With some help this could probably be easily made into something more slick. The bits I'm using are:
- OBS Websockets by Palakis
- Command line tool for obs-websocket plugin (Windows) 1.5.3 by FSC
- Autohotkey (AHK)
- A joystick/gamepad (my aim is to create a custom controller using an Arduino Pro Micro running Arduino Joystick Library Version 2.0 )
The advantage of using a joystick as input are:
- Joysticks can support up to 32 buttons and 2 HAT switches
- Pressing a joystick button should not interfere with other Windows apps
- The Arduino Micro Pro running joystick library can enumerate as multiple joysticks giving even more buttons if needed
- Above my immediate ability, but I'm sure the joystick axes could be used as faders to control volumes, etc. in OBS
The way that I done this is with a simple AHK script that triggers on a joystick button and then calls a command line to OBS to change the scene:
Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Joy1::
Run "C:\OBS Streaming Service Folder\OBS Command Line\OBSCommand.exe" /scene="Scene 1", , Hide
return
Joy2::
Run "C:\OBS Streaming Service Folder\OBS Command Line\OBSCommand.exe" /scene="Scene 2", , Hide
return
Prerequisites are OBS Websockets installed and running, the Command Line tool downloaded and extracted to a folder of your choice (from the above, on my machine this is in "C:\OBS Streaming Service Folder\OBS Command Line\") and Autohotkey installed. I haven't set any security/password on my websocket connection as I'm running it on the same machine, I'm sure it would be trivial to add that into the command line tool.
The manual thing is to know what your OBS Scene names are (case sensitive!) and then just add line to the script for as many joystick buttons and/or scenes as you need. I hope this is useful to someone.
Things that I think could fairly easily be improved upon:
- A more complex AHK script that could probably communicate directly with OBS websockets? (doing away with the Command Line interface) This requires more coding and parsing json formats, etc. Above me at this stage.
- AHK would also be able to read out the list of scenes from OBS and provide a GUI to the user to dynamically assign the keys/buttons to each scene
- Through websockets AHK could also control faders, etc.
I managed to cobble this piece of AHK script code together that gets the list of scenes from OBS, but it is json format so I'm trying to parse that at the moment:
Code:
DetectHiddenWindows On
Run %ComSpec%,, Hide, pid
WinWait ahk_pid %pid%
DllCall("AttachConsole", "UInt", pid)
WshShell := ComObjCreate("Wscript.Shell")
exec := WshShell.Exec("C:\OBS Streaming Service Folder\OBS Command Line\OBSCommand.exe /command=GetSceneList")
output := exec.StdOut.ReadAll()