A lightweight command-line client for controlling OBS Studio recording via the OBS WebSocket v5 protocol.
Useful for Wayland based compositors to map system hotkeys to OBS Actions, for example in KDE KWIN.
Built with:
- Connects to OBS via WebSocket (
ws://orwss://). - Handles the Hello → Identify → Identified handshake (with or without authentication).
- Supports recording control actions:
ToggleRecordStartRecordStopRecordPauseRecordResumeRecord
- Reads connection settings from
application.properties, overridable via environment variables.
Default values live in src/main/resources/application.properties:
obs.host=127.0.0.1
obs.port=4455
obs.path=/
obs.tls=false
obs.password=
obs.wait-seconds=2Quarkus automatically maps environment variables in UPPERCASE with underscores:
OBS_HOSTOBS_PORTOBS_PATHOBS_TLSOBS_PASSWORDOBS_WAIT_SECONDS
Example:
export OBS_HOST=192.168.1.50
export OBS_PASSWORD=supersecret./mvnw packageThis produces a runnable JAR in target/ (e.g. target/obs-ws-cli-1.0.0-runner.jar).
./mvnw package -Dnative -Dquarkus.native.container-build=trueThis produces a native binary in target/ (e.g. target/obs-ws-cli-1.0.0-runner).
java -jar target/*-runner.jar --action <Action>Where <Action> is one of:
ToggleRecordStartRecordStopRecordPauseRecordResumeRecord
Start recording (with password set via env):
OBS_PASSWORD=secret java -jar target/*-runner.jar --action StartRecordPause recording:
java -jar target/*-runner.jar --action PauseRecordToggle recording on/off:
java -jar target/*-runner.jar --action ToggleRecord- In OBS Studio, install/enable obs-websocket v5 (OBS 28+ has it built in).
- Go to
Tools → WebSocket Server Settings:- Enable server.
- Default port:
4455. - Optionally set a password.
- Run this CLI with matching
obs.host,obs.port, andobs.password.
0→ Success, got a valid response.1→ Internal error (exception, interrupted, etc).2→ Timed out waiting for a response.