Remote control OBS from the command line.
npm install obs-cli- OBS
- obs-websocket
In macOS you may install the requirements with Homebrew:
``console`
$ brew install obs obs-websocket
#### Option 1: Download the Executable
#### Option 2: Use npm
For this option you must have Node.js installed. In macOS you may install it with Homebrew:
`console`
$ brew install node
You may install obs-cli implicitly on first use by relying on npx, which comes with Node.js, for example:
`console`
$ npx obs-cli StartRecording
Or you may wish to avoid the npx prefix with an explicit global installation of obs-cli through npm, which also comes with Node.js:
`console`
$ npm install --global obs-cli
Now you may simply run, for example:
`console`
$ obs-cli StartRecording
Finally, you may wish to install obs-cli on a project managed by npm:
`console`
$ npm install obs-cli
`
Usage: obs-cli [options]
Remote control OBS from the command line.
Arguments:
request[=arguments] a request name (for example, ‘GetRecordingFolder’), optionally followed by arguments (for example, ‘SetRecordingFolder='{ "rec-folder":
"/tmp/" }'’) (see https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md for the complete list of requests
and their arguments)
Options:
-a, --address
For example:
`console
$ npx obs-cli GetRecordingFolder
[
{
"message-id": "1",
"rec-folder": "/Users/leafac/Videos",
"status": "ok",
"messageId": "1",
"recFolder": "/Users/leafac/Videos"
}
]$ npx obs-cli --field 0.rec-folder GetRecordingFolder
/Users/leafac/Videos
$ npx obs-cli SetRecordingFolder='{ "rec-folder": "/tmp/" }'
[
{
"message-id": "1",
"status": "ok",
"messageId": "1"
}
]
$ npx obs-cli GetRecordingFolder SetRecordingFolder='{ "rec-folder": "/Users/leafac/Videos" }' GetRecordingFolder
[
{
"message-id": "1",
"rec-folder": "/tmp/",
"status": "ok",
"messageId": "1",
"recFolder": "/tmp/"
},
{
"message-id": "2",
"status": "ok",
"messageId": "2"
},
{
"message-id": "3",
"rec-folder": "/Users/leafac/Videos",
"status": "ok",
"messageId": "3",
"recFolder": "/Users/leafac/Videos"
}
]
``obs-cli is a thin wrapper around obs-websocket-js, which in turn is a wrapper around obs-websocket. Read the documentations for those projects to learn more about what you can do with obs-cli. In particular, here’s the list of possible requests.
obs-cli is similar in spirit (and equal in name) to this other project. The main differences are: 1. It’s written in Node.js instead of Go; and 2. It supports authentication and everything else that obs-websocket provides, while that other project, judging by its documentation, seems to support only a few kinds of requests.