A complete example showing real-time media capture, indexing, and transcription.
This app consists of two parts running locally:
- Backend (
backend.py): Creates capture sessions, receives webhooks, and runs AI pipelines. - Client (
client.py): Captures screen and audio, streaming it to VideoDB.
- Python 3.8+
- uv (Optional but recommended): For fast package management. Install uv.
- VideoDB API Key: Get one from console.videodb.io.
-
Install Dependencies:
uv add -r requirements.txt
-
Configure Environment: Copy
.env.exampleto.envand add your API key:cp .env.example .env # Edit .env and set VIDEO_DB_API_KEY
The backend connects to VideoDB and starts a Cloudflare Tunnel for webhooks.
python backend.pyWait for the "Cloudflare Tunnel Started" message. The cloudflared binary will be downloaded automatically on the first run.
Open a new terminal and run the client.
python client.py- The client will ask for permissions (Screen/Mic).
- It will start streaming media.
- Switch to the Backend Terminal to see real-time transcripts and indexing events flowing in!
client.pycaptures media and sends it to VideoDB.- VideoDB processes the stream and sends webhooks to your
backend.py. backend.pyreceives thecapture_session.activewebhook and starts transcription and audio indexing on both audio streams (mic + system audio), and visual indexing on the display stream.- Real-time results are printed to the console via WebSocket.
Connecting to VideoDB...
Starting Cloudflare Tunnel on port 5002...
Cloudflare Tunnel Started: https://xxx.trycloudflare.com
[WEBHOOK] Event: capture_session.active
Capture Session Active! Starting AI pipelines...
Retrieved Session: session_id
Mics: 1 | System Audio: 1 | Displays: 1
Indexing system audio: stream_id
System Audio indexing started (socket: ws_id)
Indexing mic: stream_id
Mic indexing started (socket: ws_id)
Indexing display: stream_id
Visual indexing started (socket: ws_id)
[SystemAudioWatcher] real-time transcription streams live...
[MicWatcher] real-time transcription streams live...
**************************************************
[SystemAudioWatcher] Audio Index: Summary of what is being discussed
**************************************************
**************************************************
[MicWatcher] Audio Index: Summary of what is being discussed
**************************************************
**************************************************
[VisualWatcher] Visual Index: One-sentence description of screen content
**************************************************
============================================================
VideoDB Capture Client - Python Quickstart
============================================================
Connecting to backend at http://localhost:5002...
Session created successfully
Token: xxxxxxxxxx...
Session ID: session_id
--- Starting Capture Client ---
Requesting Permissions...
Discovering Channels...
Starting Recording with 3 channel(s):
- mic: channel_id
- screen: channel_id
- system_audio: channel_id
Recording... Press Enter to stop (or Ctrl+C to force quit).
Press Enter in the client terminal to stop recording gracefully. The client will send a stop signal and shut down cleanly.
Check the backend terminal for these webhook events:
capture_session.stopping- Shutdown initiatedcapture_session.stopped- Session finalizedcapture_session.exported- Video ready (includes Video ID)
You can also press Ctrl+C to force quit. The server will detect the disconnect and clean up automatically.
-
Error:
VIDEO_DB_API_KEY environment variable not set- Make sure you've created a
.envfile and set your API key
- Make sure you've created a
-
Cloudflare tunnel issues
- The
cloudflaredbinary downloads automatically on first run - If it fails, check your internet connection and firewall settings
- The
- Error:
Cannot connect to backend- Make sure the backend is running first (
python backend.py) - Check that both are using the same port (default: 5002)
- Make sure the backend is running first (
- Make sure you're generating audio or visual activity to be indexed
- Check that the WebSocket connections show "Connected!" messages
- Verify your VideoDB API key has the necessary permissions