Skip to main content

Quick Example

import videodb

conn = videodb.connect()

# Create a collection
coll = conn.create_collection(
    name="Q4 Meetings",
    description="All Q4 2024 team meetings"
)
print(coll.id)  # c-xxx

Collection Operations

Create

coll = conn.create_collection(
    name="Security Footage",
    description="Warehouse camera feeds"
)

List All

collections = conn.get_collections()
for c in collections:
    print(f"{c.id}: {c.name}")

Get by ID

coll = conn.get_collection("c-xxx-xxx")

Update

coll = conn.update_collection(
    "c-xxx-xxx",
    "New Name",
    "Updated description"
)

Delete

coll.delete()

List Media in Collection

# List videos
videos = coll.get_videos()
for v in videos:
    print(f"{v.id}: {v.name}")

# List audios
audios = coll.get_audios()

# List images
images = coll.get_images()

Search restricts results to videos in that collection - essential for RAG applications:
from videodb import SearchType

# Index videos first
video.index_spoken_words()

# Search within collection
results = coll.search("quarterly results", search_type=SearchType.semantic)
for shot in results.shots:
    print(f"{shot.start}s: {shot.text}")

Public Collections

Share collections publicly for read-only access. Anyone with the collection ID can access media and indexes.

Create Public Collection

public_coll = conn.create_collection(
    name="Demo Videos",
    description="Public demo collection",
    is_public=True
)

Toggle Visibility

# Make private
coll.make_private()
print(coll.is_public)  # False

# Make public
coll.make_public()
print(coll.is_public)  # True

Access Public Collection

Anyone can access with the collection ID:
# Access VideoDB's OCR Benchmark Collection
public_coll = conn.get_collection("c-c0a2c223-e377-4625-94bf-910501c2a31c")
videos = public_coll.get_videos()

What You Can Build

Keyword Search Compilation

Organize videos in collections and search across all of them

Multimodal Search

Build searchable video libraries with text and visual queries

Character Clips

Search collections to extract clips featuring specific people

Next Steps

Upload Video

Add media to your collections

Collection Patterns

Batching, retries, and production patterns