77
88## Features
99
10- - ** Scene Management** : Switch between scenes and scene collections.
11- - ** Recording & Streaming** : Start, stop, and toggle recording and streaming.
12- - ** Source Control** : Toggle filters, mute audio sources, and manage scene items.
13- - ** Camera Control** : Start and stop the virtual camera.
14- - ** Replay Buffer** : Manage the replay buffer, including saving replays.
15- - ** Hotkeys** : Trigger OBS hotkeys by name.
16- - ** Projectors** : Open fullscreen and source projectors.
17- - ** Media Inputs** : Control media playback, including play, pause, and restart.
10+ - ** Scene Management** : Switch between scenes, get current scene, manage scene collections
11+ - ** Recording Control** : Start, stop, pause, resume recording with status monitoring
12+ - ** Streaming Control** : Start, stop, toggle streaming with status checking
13+ - ** Source Control** : Toggle filters, mute/unmute audio sources, show/hide scene items
14+ - ** Virtual Camera** : Start, stop, toggle virtual camera output
15+ - ** Replay Buffer** : Manage replay buffer with save functionality and status tracking
16+ - ** Media Inputs** : Full media control with play, pause, stop, restart, and seek capabilities
17+ - ** Screenshots** : Capture source screenshots with custom dimensions and compression
18+ - ** Hotkeys** : Trigger any OBS hotkey by name
19+ - ** Projectors** : Open fullscreen and source-specific projectors on multiple monitors
20+ - ** System Info** : Get OBS Studio version and connection information
1821
1922## Installation
2023
@@ -24,8 +27,8 @@ You can download the latest pre-compiled binaries for your operating system from
2427
2528** Linux/macOS:**
2629``` bash
27- # Download the appropriate binary for your system
28- curl -L https://github.com/grigio/obs-cmd/releases/latest/download/obs-cmd-linux-amd64 -o obs-cmd
30+ # Download and extract the appropriate binary for your system
31+ curl -L https://github.com/grigio/obs-cmd/releases/latest/download/obs-cmd-x64-linux.tar.gz | tar xz
2932chmod +x obs-cmd
3033sudo mv obs-cmd /usr/local/bin/
3134```
@@ -71,28 +74,191 @@ export OBS_WEBSOCKET_URL=obsws://<hostname>:<port>/<password>
7174obs-cmd < command>
7275```
7376
74- ### Examples
77+ ### Commands Reference
7578
79+ #### Scene Management
7680``` bash
77- # Switch to a scene named "Live"
78- obs-cmd scene switch Live
81+ # Get current scene
82+ obs-cmd scene current
7983
80- # Start recording
84+ # Switch to a scene
85+ obs-cmd scene switch " Scene Name"
86+
87+ # Switch scene collection
88+ obs-cmd scene-collection switch " Collection Name"
89+ ```
90+
91+ #### Recording Control
92+ ``` bash
93+ # Start/stop/toggle recording
8194obs-cmd recording start
95+ obs-cmd recording stop
96+ obs-cmd recording toggle
97+
98+ # Pause/resume recording
99+ obs-cmd recording pause
100+ obs-cmd recording resume
101+ obs-cmd recording toggle-pause
102+
103+ # Check recording status
104+ obs-cmd recording status
105+ obs-cmd recording status-active
106+ ```
107+
108+ #### Streaming Control
109+ ``` bash
110+ # Start/stop/toggle streaming
111+ obs-cmd streaming start
112+ obs-cmd streaming stop
113+ obs-cmd streaming toggle
114+
115+ # Check streaming status
116+ obs-cmd streaming status
117+ ```
118+
119+ #### Virtual Camera
120+ ``` bash
121+ # Start/stop/toggle virtual camera
122+ obs-cmd virtual-camera start
123+ obs-cmd virtual-camera stop
124+ obs-cmd virtual-camera toggle
125+ ```
126+
127+ #### Replay Buffer
128+ ``` bash
129+ # Start/stop/toggle replay buffer
130+ obs-cmd replay start
131+ obs-cmd replay stop
132+ obs-cmd replay toggle
133+
134+ # Save last replay
135+ obs-cmd replay save
136+
137+ # Get last replay path
138+ obs-cmd replay last-replay
139+
140+ # Check replay buffer status
141+ obs-cmd replay status
142+ ```
82143
83- # Toggle the mute state of an audio source
144+ #### Audio Control
145+ ``` bash
146+ # Toggle mute state
84147obs-cmd audio toggle " Mic/Aux"
85148
86- # Save a screenshot of a source
149+ # Mute/unmute audio devices
150+ obs-cmd audio mute " Desktop Audio"
151+ obs-cmd audio unmute " Mic/Aux"
152+
153+ # Check audio device status
154+ obs-cmd audio status " Mic/Aux"
155+ ```
156+
157+ #### Filter Management
158+ ``` bash
159+ # Enable/disable filter
160+ obs-cmd filter enable " Source Name" " Filter Name"
161+ obs-cmd filter disable " Source Name" " Filter Name"
162+ obs-cmd filter toggle " Source Name" " Filter Name"
163+ ```
164+
165+ #### Scene Items
166+ ``` bash
167+ # Enable/disable scene items (show/hide)
168+ obs-cmd scene-item enable " Scene Name" " Source Name"
169+ obs-cmd scene-item disable " Scene Name" " Source Name"
170+ obs-cmd scene-item toggle " Scene Name" " Source Name"
171+ ```
172+
173+ #### Media Input Control
174+ ``` bash
175+ # Play/pause/stop/restart media
176+ obs-cmd media-input play " Media Source"
177+ obs-cmd media-input pause " Media Source"
178+ obs-cmd media-input stop " Media Source"
179+ obs-cmd media-input restart " Media Source"
180+
181+ # Set cursor position (format: [hh:]mm:ss)
182+ obs-cmd media-input set-cursor " Media Source" " 00:30"
183+ obs-cmd media-input set-cursor " Media Source" " 1:23:45"
184+ ```
185+
186+ #### Screenshots
187+ ``` bash
188+ # Save source screenshot
87189obs-cmd save-screenshot " Webcam" " png" " /path/to/screenshot.png"
190+
191+ # With custom dimensions
192+ obs-cmd save-screenshot " Display Capture" " jpg" " /path/to/screenshot.jpg" --width 1920 --height 1080
193+
194+ # With compression quality (for JPEG)
195+ obs-cmd save-screenshot " Source" " jpg" " /path/to/screenshot.jpg" --compression-quality 90
88196```
89197
90- For a full list of commands and options, run:
198+ #### Projectors
199+ ``` bash
200+ # Open fullscreen projector on specific monitor
201+ obs-cmd fullscreen-projector --monitor-index 1
202+
203+ # Open source projector on specific monitor
204+ obs-cmd source-projector " Webcam" --monitor-index 2
205+ ```
206+
207+ #### Hotkeys
208+ ``` bash
209+ # Trigger hotkey by name (check OBS Settings → Hotkeys for exact names)
210+ obs-cmd trigger-hotkey " OBSBasic.StartRecording"
211+ obs-cmd trigger-hotkey " OBSBasic.StopRecording"
212+
213+ # Audio mute/unmute hotkeys
214+ obs-cmd trigger-hotkey " libobs.mute"
215+ obs-cmd trigger-hotkey " libobs.unmute"
216+
217+ # Note: Hotkey functionality comes as-is and may not be reliable
218+ # For most operations, use specific commands like 'recording start' instead
219+ ```
220+
221+ #### System Information
222+ ``` bash
223+ # Get OBS Studio version and info
224+ obs-cmd info
225+ ```
226+
227+ For a complete list of commands and options, run:
91228``` bash
92229obs-cmd --help
230+ obs-cmd < command> --help
93231```
94232
95- On Linux/GNOME you can map ` obs-cmd ` commands as global shortcuts.
233+ ### Integration Examples
234+
235+ #### Linux/GNOME Shortcuts
236+ Map ` obs-cmd ` commands as global keyboard shortcuts in GNOME Settings:
237+
238+ ``` bash
239+ # Examples for custom shortcuts:
240+ # obs-cmd recording start
241+ # obs-cmd scene switch "Live"
242+ # obs-cmd streaming toggle
243+ ```
244+
245+ #### Stream Deck Integration
246+ Use ` obs-cmd ` with Stream Deck software for one-touch OBS control:
247+ - Add "System: Open" action
248+ - Point to obs-cmd executable with desired command
249+ - Example: ` /usr/local/bin/obs-cmd recording toggle `
250+
251+ #### Scripting Examples
252+ ``` bash
253+ # Bash script for stream start sequence
254+ #! /bin/bash
255+ obs-cmd scene switch " Starting Soon"
256+ sleep 5
257+ obs-cmd streaming start
258+ sleep 2
259+ obs-cmd scene switch " Live"
260+
261+ ```
96262
97263![ Example usage on Linux] ( ./static/shortcuts.png )
98264
@@ -101,6 +267,50 @@ On Linux/GNOME you can map `obs-cmd` commands as global shortcuts.
101267[ ![ Packaging status] ( https://repology.org/badge/vertical-allrepos/obs-cmd.svg )] ( https://repology.org/project/obs-cmd/versions )
102268
103269
270+ ## Requirements
271+
272+ - ** OBS Studio** 28.0+ with obs-websocket v5 plugin
273+ - ** WebSocket Server** enabled in OBS (Tools → WebSocket Server Settings)
274+ - Default connection: ` obsws://localhost:4455 ` with password ` secret `
275+
276+ ## Troubleshooting
277+
278+ ### Connection Issues
279+ ``` bash
280+ # Test connection
281+ obs-cmd info
282+
283+ # Check if OBS WebSocket is running
284+ # In OBS: Tools → WebSocket Server Settings → Enable WebSocket Server
285+ ```
286+
287+ ### Common Errors
288+ - ** Connection refused** : Ensure OBS WebSocket server is running
289+ - ** Authentication failed** : Check password in OBS WebSocket settings
290+ - ** Invalid URL format** : Use ` obsws://hostname:port/password ` format
291+
292+ ### Debug Mode
293+ Set environment variable for verbose output:
294+ ``` bash
295+ RUST_LOG=debug obs-cmd info
296+ ```
297+
298+ ## Development
299+
300+ ``` bash
301+ # Build from source
302+ cargo build --release
303+
304+ # Run tests
305+ cargo test
306+
307+ # Format code
308+ cargo fmt
309+
310+ # Lint code
311+ cargo clippy -- -D warnings
312+ ```
313+
104314## Donations
105315
106316If you find this project helpful, please consider making a donation to support its development.
0 commit comments