videodb
VideoDB Documentation
videodb
VideoDB Documentation

icon picker
Dynamic Video Stream Guide

Ashutosh Trivedi
Timeline capabilities, allows for the editing of video streams in real time ⚡️. It's like having a straightforward yet powerful interface for a video editor that can be operated in real time, seamlessly integrated with your AI systems.
But first, let's talk about an exciting upgrade to our upload function. 👉 We now support the uploading of any type of audio and image files to VideoDB making it a truly multimedia database. Whether they are sound effects 📢, music files 🎼, podcasts 🎤 or logos 🌁 VideoDB automatically recognizes the file type, eliminating the need for you to specify whether the file or URL is audio, video, or image.
audio = conn.upload(url='audio link')

Timeline

You can now craft programmatic compilation streams with audio, image and text overlays using your video data in VideoDB. This introduces innovative personalization of video streams in real time.
The Timeline object provides you with two methods: add Asset objects inline using the add_inline function, and incorporate an overlay using the add_overlay function.
Screenshot 2024-01-31 at 2.25.44 PM.jpg

Assets

Here’s more information about Asset objects: Assets such as VideoAsset and AudioAsset objects can be generated from any uploaded content. There is no limit to the number of assets you can create. To define any asset, you must provide the identifier of the media and specify the segment of the media with start and end parameters.
image (11).png
These assets can be attached to the timeline either inline or as an overlay, allowing you to compile the timeline and instantly generate a new video stream.

Quickstart

First, update you SDK.
!pip install -U videodb
Here’s a sample snippet to get you started 👉
# Assets, Timeline
from videodb.asset import VideoAsset, AudioAsset, ImageAsset
from videodb.timeline import Timeline

# get video and audio [ These are random IDs please change ]
video = collection.get_video('m-7b104a71-a761-4b63-aad8-2d00738fbf4a')
audio = collection.get_audio('m-7b104371-g761-5b63-aad8-2d00738fbf4')

timeline = Timeline(conn)

video_asset = VideoAsset(
asset_id=video.id,
start=0,
end = 20
)

video_asset_2 = VideoAsset(
asset_id=video.id,
start=1900,
end = 2000
)

audio_asset = AudioAsset(
asset_id=audio.id,
start=0,
end=0.2,
disable_other_tracks=True,
fade_in_duration=0,
fade_out_duration=0,
)

# add inline assets
timeline.add_inline(video_asset)
timeline.add_inline(video_asset_2)

# add overlay at 20 sec mark in timeline.
timeline.add_overlay(20, audio_asset)

stream_url = timeline.generate_stream()

play_stream(stream_url)

Checkout to know how to overlay a well designed text anywhere in your video stream.
For ImageAssets checkout

light
Leveraging the capabilities of automation and AI-driven content understanding, the possibilities for creation and repurposing of your content are boundless with VideoDB.

Examples and Tutorials

Audio Overlays
Automatically detect and beep out curse words in a video.
Create Compilations
Add Music/ GenAI Audio tracks
Looping of Videos and Audios

Pro Tip

If you wish to extract audio from a video, please specify this in the "media_type" field. For instance, you can obtain audio from a YouTube video by doing so.
from videodb import MediaType

audio = conn.upload(url="https://youtu.be/IoDVfXFq5cU?si=BCU7ghvqY3YdCS78", media_type=MediaType.audio)
The types of media that can be uploaded are defined in the MediaType class.

Limitations

In a scenario where two or more overlay objects cannot overlap, it is necessary to perform calculations to ensure that the duration of previous overlay objects does not extend beyond the start time on the timeline. This is a common requirement in video editing, particularly in a two-track editor setup.
Screenshot 2024-01-31 at 2.29.35 PM.jpg

Video assets must be added sequentially; it is currently not possible to overlay a video asset on top of another video or audio.
Screenshot 2024-01-31 at 2.29.52 PM.jpg
Audio assets cannot be added sequentially.
Screenshot 2024-01-31 at 2.29.45 PM.jpg


Stay tuned for more innovative ways to repurpose and enhance your content using VideoDB's automation and AI-driven features 🤘


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.