videodb
VideoDB Documentation
videodb
VideoDB Documentation
Quick Start Guide

icon picker
Collections

Collections are simple way to organize your uploads. Working with collections is straightforward. This helps in media organization and search efficiency.
Collection search would restrict the query to find information in only that collection, giving developers freedom to manage and organize videos for their RAG applications.

Create a new collection by calling create_collection function in the connection object.
conn.create_collection(name: str, description: str)

Each collection would have a unique id starting with “c-xxx-xxxx-xxx”. You can pass the name and description when you create one.
# create a new collection
new_collection = conn.create_collection(name =" test collection", description = "test description")
print(new_collection)

List all the collections you have created by calling the function get_collections
# list all collections
collections = conn.get_collections()
for c in collections:
print(c)

Get the collection by it’s unique id “c-xxx-xxxx-xxx”.
collection = conn.get_collection("c-bc849eee-dc5f-48c2-bd37-bb541c88c8ca")
print(collection)

You can update the name and description of the collection by update_collection function
# update a collection
collection = conn.update_collection("collection_id", "new_name", "new_desc")
print(collection)

Upload media to a Collection

When the collection is created you can use that to upload new video, audio, and images.
from videodb import MediaType

# create collection
new_collection = conn.create_collection("test collection", "test description")
print(new_collection)

# upload video
video = new_collection.upload(url="https://youtu.be/a9__D53WsUs?si=b1dmcLJbilNwC3H6")
print(video)

# upload audio
audio = new_collection.upload(url="https://youtu.be/MU0Yp0qmYEs?si=slWZ0HisObM14xjF", media_type=MediaType.audio)
print(audio)

# upload image
image = new_collection.upload(url="https://www.freepnglogos.com/uploads/logo-ig-png/logo-ig-instagram-new-logo-vector-download-13.png", media_type=MediaType.image)
print(image)

List all the media in a Collection (video/audio/image)

Use get methods to list audios, videos and images in the collection. We have provided individual get methods to make it simple and intuitive for you.
# list videos
videos = new_collection.get_videos()
for v in videos:
print(v)

# list audios
audios = new_collection.get_audios()
for a in audios:
print(a)

# list images
images = new_collection.get_images()
for img in images:
print(img)

Search inside a Collection

The most useful thing about collections is to restrict search to a specific set of videos. This can come really handy in building complex RAG applications.
from videodb import SearchType

# index spoken words
video.index_spoken_words()

# search inside a collection
result = new_collection.search("what is aws?", search_type=SearchType.semantic)
print(result)
stream_url = result.compile()
play_stream(stream_url)

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.