https://github.com/leafac/obs-cli
Remote control OBS from the command line
https://github.com/leafac/obs-cli
Last synced: about 1 year ago
JSON representation
Remote control OBS from the command line
- Host: GitHub
- URL: https://github.com/leafac/obs-cli
- Owner: leafac
- License: mit
- Created: 2020-11-27T23:19:48.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T10:17:44.000Z (over 3 years ago)
- Last Synced: 2025-04-13T09:44:12.447Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 173 KB
- Stars: 66
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
- [ ] Binary releases:
- [ ] Have both a tarball and a plain executable
- [ ] The tarball is good because it keeps the mode of the file (executable, +x)
- [ ] The plain executables are good because of my REAPER actions (ReaPack can’t uncompress)
- [ ] Use deno?
- [ ] Use obs-websocket-js again?
- Marco Scalet
obs-cli
Remote control OBS from the command line
### Requirements
- [OBS](https://obsproject.com)
- [obs-websocket](https://obsproject.com/forum/resources/obs-websocket-remote-control-obs-studio-from-websockets.466/)
In macOS you may install the requirements with [Homebrew](https://brew.sh):
```console
$ brew install obs obs-websocket
```
### Installation
#### Option 1: Download the Executable
#### Option 2: Use [`npm`](https://www.npmjs.com)
For this option you must have [Node.js](https://nodejs.org/) installed. In macOS you may install it with [Homebrew](https://brew.sh):
```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
```
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
the address to the machine in which OBS is running and the port configured in OBS under Tools > WebSockets Server Settings (default:
"localhost:4444")
-p, --password the password configured in OBS under Tools > WebSockets Server Settings
-f, --field project a field out of the OBS response, for example, given an OBS response of ‘[{ ..., "streaming": false, ...}]’ and a of
‘0.streaming’, obs-cli outputs just ‘false’; this is a convenience for applications that need only one part of the response
-V, --version output the version number
-h, --help display help for command
```
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](https://github.com/haganbmj/obs-websocket-js), which in turn is a wrapper around [obs-websocket](https://obsproject.com/forum/resources/obs-websocket-remote-control-obs-studio-from-websockets.466/). 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](https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md).
obs-cli is similar in spirit (and equal in name) to [this other project](https://github.com/muesli/obs-cli). The main differences are: 1. It’s written in Node.js instead of Go; and 2. It [supports authentication](https://github.com/muesli/obs-cli/issues/2) and everything else that obs-websocket provides, while that other project, judging by its documentation, seems to support only a few kinds of requests.