Skip to main content

When to Use This Reference

Use this page when you need to:
  • Understand what each SDK class represents
  • Know which object to use for your use case
  • Map between the SDK, API, and documentation

Quick Example

Core Objects

Connection

The entry point to VideoDB. Holds your API key and provides access to collections, events, and WebSocket connections.
Key methods:
  • get_collection() - Get default or specific collection
  • create_event() - Create reusable detection rules
  • connect_websocket() - Establish real-time connection

Collection

A container for organizing media assets. Every video and stream belongs to a collection.
Key methods:
  • upload(url=...) - Upload video from URL
  • upload(file_path=...) - Upload local file
  • connect_rtstream(...) - Connect live stream
  • search(...) - Search across all assets in collection
  • list_videos() - List video assets
  • list_rtstreams() - List live streams

Video

A file-based media asset. Represents uploaded videos that can be indexed, searched, and edited.
Key attributes:
  • id - Unique identifier (v-xxx)
  • name - Display name
  • length - Duration in seconds
  • stream_url - Playback URL
Key methods:
  • index_scenes(prompt=...) - Create visual index
  • index_spoken_words() - Create transcript index
  • search(query, index_id=...) - Search this video
  • generate_stream(...) - Get playback URL for time range
  • play() - Open in browser

RTStream

A real-time media stream. Represents live video from RTSP feeds, cameras, or desktop capture.
Key attributes:
  • id - Unique identifier (rts-xxx)
  • name - Display name
  • status - connected, stopped, etc.
Key methods:
  • index_visuals(prompt=...) - Create visual index
  • index_audio(prompt=...) - Create audio index
  • start_transcript() - Begin transcription
  • search(query, index_id=...) - Search this stream
  • generate_stream(start, end) - Get playback URL

CaptureSession

Desktop capture for AI agents. Stream screen, mic, and system audio from any desktop with real-time AI events.
Key attributes:
  • id - Unique identifier (cap-xxx)
  • status - pending, active, completed, stopped
  • end_user_id - Your user identifier
Key concepts:
  • Two-component architecture - Backend holds API key, desktop client uses tokens
  • Creates RTStreams - Each active channel (mic, screen, audio) creates an RTStream
  • Real-time events - Transcripts, visual indexes, and alerts delivered via webhook/WebSocket
Capture channels:
  • Microphone - User’s voice
  • Screen/Display - Visual content
  • System Audio - Audio from apps
  • Camera - Webcam feed

Index (SceneIndex)

A programmable interpretation layer that produces timestamped scene records. The key abstraction for turning raw media into searchable knowledge.
Key concepts:
  • Indexes are prompt-driven - you define what to extract
  • Indexes are additive - create multiple indexes on the same media
  • Indexes are non-destructive - add or remove without affecting source
  • Indexes support visual and spoken modalities
Key methods:
  • get_scenes() - Retrieve indexed scenes
  • create_alert(event_id, ...) - Attach alert trigger
  • start() / stop() - Control indexing

SearchResult

The result of a search query. Contains shots (moments) with timestamps and playable evidence.
Key attributes:
  • shots - List of matching moments
  • collection_id - Source collection

Shot

A single moment from search results. Contains timestamps, text, and playable stream URL. Key attributes:
  • start - Start timestamp (seconds or Unix time)
  • end - End timestamp
  • text - Content/description at this moment
  • search_score - Relevance score (0-1)
  • stream_url - Direct playback URL
Key methods:
  • generate_stream() - Get playback URL
  • play() - Open in browser

Event

A reusable detection rule defined in plain English. Events describe what to detect; alerts define where and how to deliver.

Alert

Wires an event to an index and defines delivery. When the event condition is detected, the alert fires.
Delivery options:
  • callback_url - Webhook for automation
  • ws_connection_id - WebSocket for real-time

Editor Module (Programmable Editing)

The action layer for programmable video editing lives in videodb.editor. It uses a 4-layer architecture: Asset → Clip → Track → Timeline
Asset types:
  • VideoAsset - Video content
  • AudioAsset - Music, voiceover, sound effects
  • ImageAsset - Logos, watermarks, backgrounds
  • TextAsset - Custom text overlays
  • CaptionAsset - Auto-generated subtitles
Key concepts:
  • Clips on the same track play sequentially
  • Clips on different tracks play simultaneously (layered)
  • Later tracks render on top of earlier tracks

Object Hierarchy

Next Steps

Indexes Deep Dive

Learn how to create and use indexes effectively

Search & Retrieval

Master search patterns and result handling