OSC to OBS

A Node-Red Flow that enables the use of OSC commands to control OBS.

Set the IP address and port you use in the Websocket Node. Set the port you want to use to receive OSC commands in the udp node (Default 4555). Spaces are not used in OSC addresses. This is especially a problem if you plan on using Qlab to send your OSC commands. Some of these OSC commands make use of scene names and source names in OBS which do allow spaces. To get around this replace spaces in scene names with an . Any spaces in scene names, filter names, source names, etc can be replaced with an . For example if you want to switch to a scene named "Scene 1" the command would be /Scene/Scene1. It's probably easier to just avoid spaces in your scene and source names. If you want to use a / in your source or scene name then I can't help you.

Supported commands: Set Current Scene /Scene SceneName (string) example /Scene Intro

Set Filter Visibility (enable/disable filters) /FilterVisibility/SourceName/FilterName/ 0,1 (int 0=disable 1=enable) example /FilterVisibility/Camera/Blur 0

Opacity (add a color correction filter to the source you want to control.) /Opacity/SourceName (int 0-100) example /Opacity/Camera 50

Set Source Visibility /SourceVisibility/SceneName/Source 0,1 (int 0=disable 1=enable) example /SourceVisibility/Intro/Graphic 1

Volume /Volume/SourceName (float in dB -100-20 NOTE:OBS mixer only has a range of -60-0dB however OBS supports larger values. Anything below -100 will be -inf) example /Volume/mic -10

Set Source Position X axis /SetSourcePositionX/SceneName/Source/Name/ (X postion as int) example /SetSourcePositonX/MainCamera/name 640

Set Source Position Y axis /SetSourcePositionY/SceneName/Source/Name/ (Y postion as int) example /SetSourcePostionY/Maincamera/name 520

Set Source Scale /SetSourceScale/SceneName/SourceName (Value as float 1=100 percent scale) example /SetSourceScale/Scene_2/cam 1.5

Set Preview Scene /ScenePreview/SceneName example /ScenePreview/Scene_2

Set Source Rotation /SourceRotate/SceneName/SourceName (value as float in degrees) example /SourceRotate/Scene_2/Camera 180

Enable Studio Mode /EnableStudioMode example /EnableStudioMode

Disable Studio Mode /DisableStudioMode example /DisableStudioMode

Transition from preview /TransitionTake example /TransitionTake

[{"id":"b819e831.521bd8","type":"tab","label":"OSC to OBS","disabled":false,"info":""},{"id":"38a22678.b804ca","type":"udp in","z":"b819e831.521bd8","name":"","iface":"","port":"4555","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":110,"y":260,"wires":[["aa5581d1.cabc"]]},{"id":"4afe9f3a.d07a7","type":"function","z":"b819e831.521bd8","name":"Set Current Scene","func":"let scene=msg.payload;\nlet sceneReplace=scene.replace(/\\*/g, \" \");\nmsg.payload={\n    \"request-type\": \"SetCurrentScene\",\n    \"message-id\" : \"1\",\n    \"scene-name\": sceneReplace\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":60,"wires":[["b3343065.f6417"]]},{"id":"1696e212.e7bc8e","type":"switch","z":"b819e831.521bd8","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/Scene","vt":"str"},{"t":"cont","v":"/FilterVisibility/","vt":"str"},{"t":"cont","v":"/Opacity/","vt":"str"},{"t":"cont","v":"/SourceVisibility/","vt":"str"},{"t":"cont","v":"/Volume/","vt":"str"},{"t":"cont","v":"/SetSourcePositionX/","vt":"str"},{"t":"cont","v":"/SetSourcePositionY/","vt":"str"},{"t":"cont","v":"/SetSourceScale/","vt":"str"},{"t":"cont","v":"/Preview/","vt":"str"},{"t":"cont","v":"/SourceRotate/","vt":"str"},{"t":"cont","v":"/EnableStudioMode","vt":"str"},{"t":"cont","v":"/DisableStudioMode","vt":"str"},{"t":"eq","v":"/TransitionTake","vt":"str"}],"checkall":"true","repair":false,"outputs":13,"x":490,"y":240,"wires":[["4afe9f3a.d07a7"],["ef47ce70.98cdd"],["f8f8c3a7.8cf9d"],["378f2a94.bb68f6"],["6ca14225.f069cc"],["d52de5a2.537768"],["8b605d64.d9765"],["c0448141.0cdb5"],["5f11bb48.956454"],["ca60f345.c5712"],["cab5724b.28337"],["7969f2f5.f6675c"],["1acb0897.abc1c7"]]},{"id":"f8f8c3a7.8cf9d","type":"function","z":"b819e831.521bd8","name":"Opacity","func":"let source=msg.topic.split(\"/\")[2];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet Val=msg.payload\n\nmsg.payload={\n    \"request-type\": \"SetSourceFilterSettings\", \n    \"message-id\" : \"1\",\n    \"sourceName\" : sourceReplace, \n    \"filterName\": \"Color Correction\", \n    \"filterSettings\": {\"opacity\": Val}\n    \n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":740,"y":260,"wires":[["b3343065.f6417"]]},{"id":"ef47ce70.98cdd","type":"function","z":"b819e831.521bd8","name":"Set Source Filter Visibility","func":"let source=msg.topic.split(\"/\")[2];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet filter=msg.topic.split(\"/\")[3];\nlet filterReplace=filter.replace(/\\*/g, \" \");\nlet state=msg.payload;\nlet statebool=state!=0?true:false;\n\nmsg.payload={\n    \"request-type\": \"SetSourceFilterVisibility\", \n    \"message-id\" : \"1\",\n    \"sourceName\": sourceReplace, \n    \"filterName\": filterReplace, \n    \"filterEnabled\": statebool\n    }\nreturn msg;\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":160,"wires":[["b3343065.f6417"]]},{"id":"378f2a94.bb68f6","type":"function","z":"b819e831.521bd8","name":"Set Source Visibility","func":"let scene=msg.topic.split(\"/\")[2];\nlet sceneReplace=scene.replace(/\\*/g, \" \");\nlet source=msg.topic.split(\"/\")[3];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet state=msg.payload;\nlet statebool=state!=0?true:false;\nmsg.payload={\n    \"request-type\": \"SetSceneItemProperties\", \n    \"message-id\" : \"1\",\n    \"scene-name\":sceneReplace,\n    \"item\": sourceReplace, \n    \"visible\": statebool\n    }\nreturn msg;\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":360,"wires":[["b3343065.f6417"]]},{"id":"ec57ed34.93483","type":"comment","z":"b819e831.521bd8","name":" /Scene SceneName","info":"","x":770,"y":100,"wires":[]},{"id":"9f0167a0.2b7ce8","type":"comment","z":"b819e831.521bd8","name":"/FilterVisibility/SourceName/FilterName 0,1","info":"","x":840,"y":200,"wires":[]},{"id":"bce6927c.89524","type":"comment","z":"b819e831.521bd8","name":"/Opacity/Source 0-100","info":"","x":780,"y":300,"wires":[]},{"id":"7e1aea06.525f14","type":"comment","z":"b819e831.521bd8","name":"/SourceVisibility/SceneName/SourceName 0,1","info":"","x":850,"y":400,"wires":[]},{"id":"6ca14225.f069cc","type":"function","z":"b819e831.521bd8","name":"Volume","func":"let source=msg.topic.split(\"/\")[2];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet Val=msg.payload\n\nmsg.payload={\n    \"request-type\": \"SetVolume\", \n    \"message-id\" : \"1\",\n    \"source\" : sourceReplace, \n    \"volume\": Val,\n    \"useDecibel\":true\n    \n}\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":740,"y":460,"wires":[["b3343065.f6417"]]},{"id":"3815a34c.3672bc","type":"comment","z":"b819e831.521bd8","name":"/Volume/Source 0-1Float","info":"","x":780,"y":500,"wires":[]},{"id":"b3343065.f6417","type":"websocket out","z":"b819e831.521bd8","name":"","server":"16702332.a6c11d","client":"","x":1320,"y":280,"wires":[]},{"id":"2b129eb1.a3aa62","type":"websocket in","z":"b819e831.521bd8","name":"","server":"16702332.a6c11d","client":"","x":1260,"y":520,"wires":[["6fa42212.1ad28c"]]},{"id":"6fa42212.1ad28c","type":"debug","z":"b819e831.521bd8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1550,"y":480,"wires":[]},{"id":"d52de5a2.537768","type":"function","z":"b819e831.521bd8","name":"Source Position","func":"let scene=msg.topic.split(\"/\")[2];\nlet sceneReplace=scene.replace(/\\*/g, \" \");\nlet source=msg.topic.split(\"/\")[3];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet xPos=msg.payload;\n\n\nmsg.payload={\n \"request-type\": \"SetSceneItemProperties\", \n\"message-id\" : \"1\", \n\"scene-name\": sceneReplace, \n\"item\": sourceReplace, \n\"position\": {\"x\":xPos}\n    \n}\n    \n\n\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":760,"y":560,"wires":[["b3343065.f6417"]]},{"id":"6056ff35.7e0a7","type":"comment","z":"b819e831.521bd8","name":"/SetSourcePositionX/Scene/Source X int","info":"","x":830,"y":600,"wires":[]},{"id":"8b605d64.d9765","type":"function","z":"b819e831.521bd8","name":"Source Position","func":"let scene=msg.topic.split(\"/\")[2];\nlet sceneReplace=scene.replace(/\\*/g, \" \");\nlet source=msg.topic.split(\"/\")[3];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet yPos=msg.payload;\n\n\nmsg.payload={\n \"request-type\": \"SetSceneItemProperties\", \n\"message-id\" : \"1\", \n\"scene-name\": sceneReplace, \n\"item\": sourceReplace, \n\"position\": {\"y\":yPos}\n    \n}\n    \n\n\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":760,"y":640,"wires":[["b3343065.f6417"]]},{"id":"c0448141.0cdb5","type":"function","z":"b819e831.521bd8","name":"Source Scale","func":"let scene=msg.topic.split(\"/\")[2];\nlet sceneReplace=scene.replace(/\\*/g, \" \");\nlet source=msg.topic.split(\"/\")[3];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet Scale=msg.payload;\n\n\nmsg.payload={\n \"request-type\": \"SetSceneItemProperties\", \n\"message-id\" : \"1\", \n\"scene-name\": sceneReplace, \n\"item\": sourceReplace, \n\"scale\": {\"x\":Scale,\"y\":Scale}\n    \n}\n    \n\n\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":720,"wires":[["b3343065.f6417"]]},{"id":"641b5706.290588","type":"comment","z":"b819e831.521bd8","name":"/SetSourcePositionY/Scene/Source Y int","info":"","x":830,"y":680,"wires":[]},{"id":"aac0d6e3.6b3c48","type":"comment","z":"b819e831.521bd8","name":"/SetSourceScale/Scene/Source Float 1=100%","info":"","x":850,"y":760,"wires":[]},{"id":"5f11bb48.956454","type":"function","z":"b819e831.521bd8","name":"Set Preview Scene","func":"let scene=msg.payload;\nlet scenePreviewReplace=scene.replace(/\\*/g, \" \");\nmsg.payload={\n    \"request-type\": \"SetPreviewScene\",\n    \"message-id\" : \"1\",\n    \"scene-name\": scenePreviewReplace\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":800,"wires":[["b3343065.f6417"]]},{"id":"b23b8a1a.9b04b8","type":"comment","z":"b819e831.521bd8","name":"/Preview SceneName","info":"","x":770,"y":840,"wires":[]},{"id":"ca60f345.c5712","type":"function","z":"b819e831.521bd8","name":"Source rotate","func":"let scene=msg.topic.split(\"/\")[2];\nlet sceneReplace=scene.replace(/\\*/g, \" \");\nlet source=msg.topic.split(\"/\")[3];\nlet sourceReplace=source.replace(/\\*/g, \" \");\nlet rotation=msg.payload;\n\n\nmsg.payload={\n \"request-type\": \"SetSceneItemProperties\", \n\"message-id\" : \"1\", \n\"scene-name\": sceneReplace, \n\"item\": sourceReplace, \n\"rotation\": rotation\n}\n    \n\n\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":880,"wires":[["b3343065.f6417"]]},{"id":"3681ad4d.66eae2","type":"comment","z":"b819e831.521bd8","name":"/SourceRotate/Scene/Source int in degrees","info":"","x":840,"y":920,"wires":[]},{"id":"cab5724b.28337","type":"function","z":"b819e831.521bd8","name":"EnableStudioMode","func":"msg.payload={\n \"request-type\": \"EnableStudioMode\", \n\"message-id\" : \"1\"\n}\n    \n\n\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":980,"wires":[["b3343065.f6417"]]},{"id":"7969f2f5.f6675c","type":"function","z":"b819e831.521bd8","name":"DisableStudioMode","func":"msg.payload={\n \"request-type\": \"DisableStudioMode\", \n\"message-id\" : \"1\"\n}\n    \n\n\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":1060,"wires":[["b3343065.f6417"]]},{"id":"b17ec9ae.eee5d8","type":"comment","z":"b819e831.521bd8","name":"/EnableStudioMode","info":"","x":770,"y":1020,"wires":[]},{"id":"3ca63be8.60b614","type":"comment","z":"b819e831.521bd8","name":"/DisableStudioMode","info":"","x":770,"y":1100,"wires":[]},{"id":"8f947dcf.aae7e","type":"debug","z":"b819e831.521bd8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":190,"y":460,"wires":[]},{"id":"1acb0897.abc1c7","type":"function","z":"b819e831.521bd8","name":"Transition","func":"msg.payload={\n    \"request-type\": \"TransitionToProgram\",\n    \"message-id\" : \"1\"\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":740,"y":1160,"wires":[["b3343065.f6417"]]},{"id":"3739613c.5e211e","type":"comment","z":"b819e831.521bd8","name":"/TransitionTake","info":"","x":750,"y":1200,"wires":[]},{"id":"aa5581d1.cabc","type":"osc","z":"b819e831.521bd8","name":"","path":"","metadata":false,"x":290,"y":260,"wires":[["1696e212.e7bc8e","8f947dcf.aae7e"]]},{"id":"16702332.a6c11d","type":"websocket-listener","path":"ws://127.0.0.1:4444","wholemsg":"false"}]

Flow Info

Created 4 years, 7 months ago
Rating: not yet rated

Actions

Rate:

Node Types

Core
  • comment (x13)
  • debug (x2)
  • function (x13)
  • switch (x1)
  • udp in (x1)
  • websocket in (x1)
  • websocket out (x1)
  • websocket-listener (x1)
Other
  • osc (x1)
  • tab (x1)

Tags

  • obs
  • osc
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option