videodb
VideoDB Documentation
videodb
VideoDB Documentation
Examples and Tutorials

icon picker
Instant Clips of Your Favorite Characters

Overview

We all have our favorite characters in TV shows the we love. What if you could create the clips of the scenes when they appear? You can use it in your content creation, analysis workflow or simply observe how they talk, dress or act in an episode.
VideoDB is the database for your AI applicaitons and enables it with ease. No need for fancy editing software or waiting around – you get to view your video right away. ⚡️
image.png

Workflow

Here’s a from HBO's Silicon Valley show. We've already identified instances when Gilfoyle, Jian Yang, Erlich, Jared, Dinesh and Richard make appearances. (This was achieved using . If you're curious about the full process, including how to index faces and pinpoint timestamps in videos, check out our
where we walk through the entire process.)
Screenshot 2023-12-29 at 1.18.55 PM.jpg
We've pinpointed the timestamps of the characters' appearances in the video and mapped out where they appear in persons_data
Next, we'll upload the video to VideoDB and use these timestamps to clip the video. It's as easy as querying a database⚡️

Setup

🔧 Installing VideoDB in your environment

VideoDB is available as a
!pip install videodb


🔗 Setting Up a connection

To connect to VideoDB, simply create a Connection object.
This can be done by either providing your VideoDB API key directly to the constructor or by setting the VIDEO_DB_API_KEY environment variable with your API key.
light
Get your API key from . ( Free for first 50 uploads, No credit card required ) 🎉
from videodb import connect
conn = connect(api_key="YOUR_API_KEY")

Timeline Data

Here’s the json we compiled with the timestamps of appearances of each character. The persons_data contains timeline for each character, representing the timestamps of shots when they were present in the video.

Creating instant clips using VideoDB

info
The idea behind VideoDB is straightforward: it functions as a database specifically for videos. Similar to uploading tables or JSON data to a standard database, you can upload your videos to VideoDB.
You can also retrieve your videos through queries, much like accessing regular data from a database.
You can pass timeline of each person in video.generate_stream() and get the streaming link almost instantly.
v_url = "https://www.youtube.com/watch?v=NNAgJ5p4CIY"
video = conn.upload(url=v_url)

# store stream of each person
for person in persons_data:
person_data = persons_data[person]
stream_link = video.generate_stream(timeline=person_data["timeline"])
person_data["clip"] = stream_link

Results

light
We effortlessly uploaded our video to VideoDB and generated clips for each character in just 30 seconds.
Now, it's time to check out our results.
Let's take a look at a clip featuring Erlich Bachman (feel free to choose your favorite character by changing the name field below)
from videodb import play_stream

name = "erlich"
play_stream(persons_data[name]["clip"])
Load content from console.videodb.io?
Loading external content may reveal information to 3rd parties. Learn more
Allow

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.