General
Allows you to request data from OBS websocket and save it in a variable.
This command should be followed by a Wait until Variable Exists
command with an adequate timeout to allow the data to be sent to SAMMI.
All the possible requests are documented here for version 5.0, and here for version 4.9.1 (and version 4.x-compat).
The requested value will always be inside an object called responseData
, but may be inside a second object. You can access it with object dot notation.
For example, if you want to retrieve the Brightness value from a Colour Correction filter, you will notice that it is inside an object called filterSettings. { "filterEnabled": true, "filterKind": "color_filter_v2", "filterSettings": { "brightness": 0.078 }, "filterIndex": 0.0 }
. In this case, the Fetch Value will be responseData.filterSettings.brightness
.
Use JSON string validator if you want to make sure your formatting is correct.
(Filter.Transform.Rotation.X)
.
Box Name | Type | Description |
---|---|---|
OBS | Dropdown | OBS to send this command to (if using multiple OBS connections). |
OBS Command (JSON) | JSON String | JSON String to send to OBS Websocket. Will default to OBSws5 syntax:{"op":6,"d":{"requestType":"","requestData":{}}} |
Fetch Value | String or object | Name of a value you wish to get. Leave blank to fetch the whole object. For values inside another object use object dot notation. For values inside an array use index position. |
Save Variable As | String | Name of a variable to save the data under. |
Send OBS Request Examples
What to retrieve | OBS Command | Fetch Value |
---|---|---|
current CPU usage | {"op":6,"d":{ |
responseData.cpuUsage |
Time elapsed since streaming started | {"op":6,"d":{ |
responseData.outputTimecode |
Scene Item ID of a source | {"op":6,"d":{ |
responseData.sceneItemId |
Current width of a source | {"op":6,"d":{ |
responseData.sceneItemTransform.width |
Current text in a GDI source | {"op":6,"d":{ |
responseData.inputSettings.text |
Brightness value of a Colour Correction filter | {"op":6,"d":{ |
responseData.filterSettings.brightness |
First source name in a specified scene | {"op":6,"d":{ |
responseData.sceneItems[0].sourceName |
Enables or disables studio mode in your OBS.
Box Name | Type | Description |
---|---|---|
OBS | Dropdown | OBS to send this command to (if using multiple OBS) |
Enable | Checkbox | Checked = enable studio mode, unchecked = disable studio mode |
Activates any OBS hotkey without having to manually press it.
You can find the unique name of a hotkey in one of these two locations:
- For general hotkeys:
basic.ini
file inC:/Users/USERNAME/AppData/Roaming/obs-studio/basic/profiles/YOUR_CURRENT_PROFILE
- For source-specific hotkeys:
YOURSCENENAME.JSON
file inC:/Users/USERNAME/AppData/Roaming/obs-studio/basic/scenes
Once you open the file, look for[HOTKEYS]
section which should have all your unique hotkey names listed.
Box Name | Type | Description |
---|---|---|
OBS | Dropdown | OBS to send this command to (if using multiple OBS) |
Hotkey Name | String | Unique name of the hotkey |
Executes hotkey routine.
Does not actually perform the key presses, it simply activates any hotkey action you’ve set.
Box Name | Type | Description |
---|---|---|
OBS | Dropdown | OBS to send this command to (if using multiple OBS) |
Key ID | String | Main key ID, such as A or F1. It has to be the OBS name for it, such as OBS_KEY_A. All OBS hotkeys can be found in OBS Studio’s documentation. |
Ctrl | Checkbox | Whether to include CTRL key |
Alt | Checkbox | Whether to include Alt key |
Shift | Checkbox | Whether to include Shift key |
Sends a custom packet to the OBS websocket in JSON format.
All the possible requests are documented in OBS websocket protocol reference.
If the value you’re requesting is inside an object, you have to provide the whole object. For example, to set the scale for a scene item in SetSceneItemProperties
request, you need to do: "scale":{"x":NEW SCALE X, "y":NEW SCALE Y }
, just scale.x : NEW SCALE X
is not gonna work as it’s not a valid JSON format.
"message-id":1
is needed at the end of your request.
Use JSON string validator if you want to make sure your formatting is correct.
Box Name | Type | Description |
---|---|---|
OBS | Dropdown | OBS to send this command to (if using multiple OBS) |
Custom Packet | JSON String | JSON string to send to OBS Websocket. |
Custom packet examples
JSON String | Description |
---|---|
{"request-type":"SetCurrentProfile","profile-name":"YOURPROFILENAME", "message-id":"1"} |
changes active profile in OBS |
{"request-type":"SetSceneItemProperties","scene-name":"YOURSCENENAME", "item": {"name":"YOURSOURCENAME"}, "position": {"x":500, "y":500 }, "scale":{"x":0.5, "y":0.5}, "locked":true, "message-id":"1"} |
changes position and scale of a source and locks it |
{"request-type":"StartRecording", "message-id":"1"} |
Starts recording |
{"request-type":"StartReplayBuffer", "message-id":"1"} |
Starts replay buffer |