A REST API server to start, stop, and download screen recordings.
- Go 1.24.3+ - Programming language runtime
- ffmpeg - Video recording engine
- macOS:
brew install ffmpeg - Linux:
sudo apt install ffmpegorsudo yum install ffmpeg
- macOS:
- pnpm - For OpenAPI code generation
npm install -g pnpm
- macOS: Uses AVFoundation for screen capture
- Linux: Uses X11 for screen capture
- Windows: Not currently supported
make devThe server will start on port 10001 by default and log its configuration.
# 1. Start a new recording
curl http://localhost:10001/recording/start -d {}
# (recording in progress)
# 2. Stop recording
curl http://localhost:10001/recording/stop -d {}
# 3. Download the recorded file
curl http://localhost:10001/recording/download --output recording.mp4# Clipboard operations
# | GET /clipboard - Get clipboard content
curl http://localhost:10001/clipboard
# | POST /clipboard - Set clipboard content
curl -X POST -H "Content-Type: application/json" \
--data '{"type":"text","text":"Hello from clipboard!"}' \
http://localhost:10001/clipboard
# | GET /clipboard/stream - Stream clipboard changes as SSE
# Keep this running in one terminal
curl -N http://localhost:10001/clipboard/stream
# In another terminal, set clipboard content to see events
curl -X POST -H "Content-Type: application/json" \
--data '{"type":"text","text":"Clipboard update"}' \
http://localhost:10001/clipboardConfigure the server using environment variables:
| Variable | Default | Description |
|---|---|---|
PORT |
10001 |
HTTP server port |
FRAME_RATE |
10 |
Default recording framerate (fps) |
DISPLAY_NUM |
1 |
Display/screen number to capture |
MAX_SIZE_MB |
500 |
Default maximum file size (MB) |
OUTPUT_DIR |
. |
Directory to save recordings |
FFMPEG_PATH |
ffmpeg |
Path to the ffmpeg binary |
export PORT=8080
export FRAME_RATE=30
export MAX_SIZE_MB=1000
export OUTPUT_DIR=/tmp/recordings
./bin/api- YAML Spec:
GET /spec.yaml - JSON Spec:
GET /spec.json
The server uses OpenAPI code generation. After modifying openapi.yaml:
make oapi-generatemake test