DreamLake

Video SDK

Load, slice, and batch video data in Python. All operations are lazy until data is accessed.

Load

python
import dreamlake as dl

video = dl.load_video("v-BV1bW411n7fY9x01")
print(video.fps, video.duration, video.width, video.height)

Slice

float = time (seconds), int = frame number. Returns a lazy Video.

python
clip = video[10.0:20.0]       # 10s clip
frame = video[42]              # frame 42
sub = clip[2.0:5.0]           # sub-slice → Video(st=12.0, et=15.0)

Access Frames

python
video[0].image                 # PIL Image
video[0].numpy()               # (H, W, 3)
clip.numpy()                   # (N, H, W, 3)
clip.tensor()                  # (N, C, H, W) torch tensor
video.thumbnail                # middle frame

Chunk & Batch

python
chunks = video[0.0:2.0].chunk(0.200)   # VideoArray of 10 × 200ms
chunks[:, 0].numpy()                     # first frame of each → (10, H, W, 3)
chunks[:, 0].tensor()                    # feed to model

TextTrack

Buffer time-aligned text entries, flush to server:

python
track = dl.text_track(prefix="/run-042/captions", project="robotics@alice")
track.add("Robot picks up cup", source=clip)
track.flush()

VectorIndex

Store and search embeddings:

python
index = dl.vec_index("my-experiment")
index.add(vector=enc(clip[0]), caption="robot arm", source=clip)
results = index.search("robot picking up cup", limit=10)

Prefix Context

python
with dl.Prefix(project="robotics@alice", prefix="/2026/04/run-042"):
    dl.upload("./video.mp4", path="camera/front")
    track = dl.text_track(path="captions/llava")