Skip to main content

Quick Example

import videodb

conn = videodb.connect()
coll = conn.get_collection()

# Connect a live stream
rtstream = coll.connect_rtstream(
    name="Lobby Camera",
    url="rtsp://user:[email protected]:554/stream"
)
print(rtstream.id)  # rts-xxx

Connection Methods

RTSP URL Format

rtsp://[username:password@]host[:port]/path
Examples:
rtsp://admin:[email protected]:554/live
rtsp://camera.example.com:554/stream1
rtsp://user:[email protected]/cam/realmonitor

Connect from Camera

# IP Camera
rtstream = coll.connect_rtstream(
    name="Warehouse Camera 1",
    url="rtsp://admin:[email protected]:554/live"
)

# Encoder/NVR
rtstream = coll.connect_rtstream(
    name="NVR Channel 3",
    url="rtsp://admin:[email protected]:554/ch3"
)

RTStream Object

After connecting, you receive an RTStream object:
AttributeTypeDescription
idstrUnique identifier (rts-xxx)
namestrLabel you supplied
collection_idstrParent collection
statusstrconnected, stopped, etc.
sample_ratefloatFrame rate (default: 1 fps)
audioboolAudio ingestion enabled

Retrieve Existing Streams

Get by ID

rtstream = coll.get_rtstream("rts-xxx")

List All Streams

rtstreams = coll.list_rtstreams(
    limit=10,
    offset=0,
    status="connected",
    name="Lobby",
    ordering="-created_at"
)
ParameterDescription
limitNumber of results
offsetSkip N results
statusFilter by status
nameFilter by name
orderingSort field (prefix - for descending)

Playback URLs

Generate HLS/MP4 URLs for any time range using Unix timestamps:
import time

# Get playback URL for last 60 seconds
now = int(time.time())
start = now - 60
stream_url = rtstream.generate_stream(start=start, end=now)
The start and end parameters expect Unix timestamps (seconds since epoch), not relative time offsets.

Supported Sources

SourceFormatNotes
IP CamerasRTSPMost common, H.264/H.265
NVR/DVRRTSPPer-channel streams
EncodersRTSP/RTMPOBS, FFmpeg, hardware encoders
Streaming ServersRTSPWowza, nginx-rtmp

Connection Notes

  • Secure Storage - All video feeds are securely stored and accessible anytime
  • Default Sample Rate - Streams are ingested at 1 fps by default
  • Network - Ensure your RTSP source is accessible from VideoDB’s servers

What You Can Build


Next Steps