* 'Remote' Controls OBS Through Websockets.
to actually control it.
OBS + (Websocket) SERVer
And notably, to control it.
It grabs the automatically generated json from the "protocol" defined by the websocket server. re: https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.json
Then automatically converts (or "generates" via gens.rkt) usable Racket code (ie: s-expressions) as auto.rkt that can called as-is or built on-top of. And the latter, we build the "api.rkt" on.
And the point?
You can script OBS-Studio to "do whatever".
We want to cover a solid chunk of total requestable stuff "eventually" (tm). But will come with time... because we are basically just adding stuff as-needed rn.
We want to get password auth working. But for local connection, even non-funneled tailscale I think this should be "fine" for now.
Bunch of other services, Twitch x Discord (or at least to Bandbit) namely for my usecase maybe eventually youtube, rumble, kick,etc.
We should be able to log anything / everything that gets entered into the repl. Right now we just are grabbing incoming-json (storing in a global var) and pooping it out to a "log file".
Add a nice, easy, idiomatic way to 'pull' information from the json we recieve.
Want to basically have it be easily to respond to
Have something adjacent to 'Mix It Up' & Others. I also basically want a "key macro" based stream-deck adjacent thingy.
Need to see how viable using 'media source' is to essentially make a media-player around it.
Ideally I don't want any depends outside OBS itself and Racket; But MPV and Playerctl is on thet table / possible if
I can't really get what I want ... but I'm somewhat optimistic I can.
You can connect multiple clients at a time to OBS, so we should have a threading model that doesn't lock up the repl for longer-tasks. Should be able to trivially call and effectively just makes a new client
Right now, unless you know Racket I still think it's fairly hard to get
A comprehensive Racket library for controlling OBS Studio via WebSocket
Observ is a powerful Racket library that provides complete control over OBS Studio through its WebSocket API. Perfect for streamers, content creators, and automation enthusiasts who want to programmatically control their broadcasting setup.
38 Complete OBS Functions - Control every aspect of OBS Studio
Functional Design - Clean, composable functions with proper error handling
Parameter Architecture - Automatic connection management via current-conn
Macro System - Powerful define-obs-api
macro for custom functions
REPL Integration - Interactive development with enhanced REPL
Workflow Automation - Built-in support for complex streaming workflows
Comprehensive Tests - Full RackUnit test suite with 18+ test cases
#lang racket
(require observ)
;; Connect to OBS
(connect-obs)
;; Check OBS version
(obs!version)
;; List available scenes
(obs!scene-list)
;; Switch to a scene
(obs!scene-switch #:to "Main Scene")
;; Start recording
(obs!record-start)
Racket 8.0 or higher
OBS Studio 28.0+ with WebSocket plugin enabled
Network access to OBS WebSocket server (default: localhost:4455)
git clone https://github.com/megalisp/observ.git
cd observ
raco pkg install
Open OBS Studio
Go to Tools โ WebSocket Server Settings
Enable the WebSocket server
Note the server port (default: 4455)
Set authentication if desired
;; Scene management
(obs!scene-list)
(obs!scene-switch #:to "Gaming Scene")
(obs!scene-create #:name "New Scene")
;; Audio control
(obs!audio-mute #:input "Desktop Audio")
(obs!audio-set-volume #:input "Mic/Aux" #:level 0.8)
;; Recording/Streaming
(obs!record-start)
(obs!stream-start)
(define (go-live #:countdown [countdown 5])
;; Pre-stream setup
(obs!scene-switch #:to "Starting Soon")
(obs!audio-unmute #:input "Mic/Aux")
(obs!virtualcam-start)
;; Countdown
(for ([i (in-range countdown 0 -1)])
(printf "Going live in ~a...\n" i)
(obs!sleep #:secs 1))
;; Go live!
(obs!scene-switch #:to "Live Scene")
(obs!stream-start)
(printf "๐ด LIVE!\n"))
;; Usage
(go-live #:countdown 3)
# Start the interactive OBS REPL
./main.rkt
# Or from Racket REPL:
> (require observ/repl)
> (connect-obs)
> (obs!version)
(define-obs-api (obs!stream-setup #:scene scene #:mic-level level)
'(#:scene #:mic-level)
"Complete streaming setup workflow"
(obs!scene-switch #:to scene)
(obs!audio-unmute #:input "Mic/Aux")
(obs!audio-set-volume #:input "Mic/Aux" #:level level)
(obs!virtualcam-start)
(format "Stream ready on scene: ~a" scene))
;; Use your custom function
(obs!stream-setup #:scene "Gaming" #:mic-level 0.75)
Observ includes comprehensive examples in the examples/
directory to help you get started quickly:
| Example | Description | Use Case |
|---------|-------------|----------|
| quick-stream-setup.rkt
| Rapid streaming setup with webcam and screen capture | New streamers |
| gaming-stream.rkt
| Gaming scenes with capture, facecam, and chat | Gaming content |
| presentation-mode.rkt
| Presentation and coding tutorial scenes | Educators/Speakers |
| simple-recorder.rkt
| Recording setup with countdown functionality | Content creation |
| audio-mixer.rkt
| Audio control with preset configurations | Audio management |
| stream-automation.rkt
| Complete automated streaming workflow | Professional streaming |
| scene-switcher.rkt
| Quick scene switching with hotkey-like functions | Live stream control |
| content-creator.rkt
| Tools for tutorials and educational content | Content creators |
| browser-megalisp.rkt
| Browser source integration demo | Web content |
| examples-index.rkt
| Overview and quick loader for all examples | Getting started |
Load any example into your REPL session:
;; From the main REPL
(obs!load #:file "examples/quick-stream-setup.rkt")
;; Or load the examples index for an overview
(obs!load #:file "examples/examples-index.rkt")
๐ฏ Practical Use Cases - Real-world streaming and recording scenarios
๐ ๏ธ Ready-to-Use Functions - Pre-built workflows you can use immediately
๐ Educational - Learn OBS automation patterns and best practices
๐ง Customizable - Easy to modify for your specific setup
โก Quick Start - Get up and running in seconds
Start with examples-index.rkt
to see all available examples and their quick-load functions!
| Category | Functions |
|----------|-----------|
| Info | obs!version
, obs!stats
|
| Scenes | obs!scene-list
, obs!scene-switch
, obs!scene-create
|
| Audio | obs!audio-mute
, obs!audio-set-volume
, obs!audio-get-volume
|
| Recording | obs!record-start
, obs!record-stop
, obs!record-toggle
|
| Streaming | obs!stream-start
, obs!stream-stop
, obs!stream-toggle
|
| Virtual Cam | obs!virtualcam-start
, obs!virtualcam-stop
|
| Utilities | obs!sleep
, obs!load
|
;; Connect with custom options
(connect-obs #:host "localhost"
#:port 4455
#:password "secret"
#:auto-record? #t
#:auto-scene "Main Scene")
;; Current connection parameter
(current-conn) ; Get current connection
(current-conn new-conn) ; Set connection
Run the comprehensive test suite:
racket test.rkt
Results show all 38 functions tested across 5 categories:
โ Function Existence (9 test cases)
โ Arity Validation (3 test cases)
โ Parameter System (2 test cases)
โ Function Count (2 test cases)
โ Integration (2 test cases)
Full documentation available in the included Scribble manual:
raco scribble manual.scrbl
Contributions welcome! Observ is open source under Apache 2.0 OR MIT license.
Report bugs: GitHub Issues
Submit PRs: GitHub Pull Requests
Improve docs: Documentation improvements always appreciated
Copyright ยฉ 2025 megalisp
Licensed under either of:
at your option.
Comprehensive: All 38 major OBS functions covered
Reliable: Comprehensive test suite ensures stability
Extensible: Macro system for custom workflows
Interactive: REPL integration for live development
Functional: Clean, composable design
Well-documented: Complete manual and examples
Perfect for:
๐ฎ Streamers - Automate scene switching and audio control
๐ฅ Content Creators - Programmatic recording workflows
๐ง Developers - Integration with streaming applications
๐ค Automation - Complex broadcast automation systems
Ready to take control of your OBS setup? Get started with Observ today! ๐