Skip to content
videodb
VideoDB Documentation
  • Pages
    • Welcome to VideoDB Docs
    • Quick Start Guide
      • Video Indexing Guide
      • Semantic Search
      • Collections
      • Public Collections
      • Callback Details
      • Ref: Subtitle Styles
      • Language Support
      • Guide: Subtitles
      • How Accurate is Your Search?
    • Visual Search and Indexing
      • Scene Extraction Algorithms
      • Custom Annotations
      • Scene-Level Metadata: Smarter Video Search & Retrieval
      • Advanced Visual Search Pipelines
      • Playground for Scene Extractions
      • Deep Dive into Prompt Engineering : Mastering Visual Indexing
      • How VideoDB Solves Complex Visual Analysis Tasks
      • Multimodal Search: Quickstart
      • Conference Slide Scraper with VideoDB
    • Examples and Tutorials
      • Dubbing - Replace Soundtrack with New Audio
      • VideoDB: Adding AI Generated voiceovers to silent footage
      • Beep curse words in real-time
      • Remove Unwanted Content from videos
      • Instant Clips of Your Favorite Characters
      • Insert Dynamic Ads in real-time
      • Adding Brand Elements with VideoDB
      • Elevating Trailers with Automated Narration
      • Add Intro/Outro to Videos
      • icon picker
        Audio overlay + Video + Timeline
      • Building Dynamic Video Streams with VideoDB: Integrating Custom Data and APIs
      • AI Generated Ad Films for Product Videography
      • Fun with Keyword Search
      • Overlay a Word-Counter on Video Stream
      • Generate Automated Video Outputs with Text Prompts | VideoDB
      • VideoDB x TwelveLabs: Real-Time Video Understanding
      • Multimodal Search
      • How I Built a CRM-integrated Sales Assistant Agent in 1 Hour
      • Make Your Video Sound Studio Quality with Voice Cloning
      • Automated Traffic Violation Reporter
    • Live Video→ Instant Action
    • Generative Media Quickstart
      • Generative Media Pricing
    • Video Editing Automation
      • Fit & Position: Aspect Ratio Control
      • Trimming vs Timing: Two Independent Timelines
      • Advanced Clip Control: The Composition Layer
      • Caption & Subtitles: Auto-Generated Speech Synchronization
      • Notebooks
    • Transcoding Quickstart
    • director-light
      Director - Video Agent Framework
      • Agent Creation Playbook
      • Setup Director Locally
    • Workflows and Integrations
      • zapier
        Zapier Integration
        • Auto-Dub Videos & Save to Google Drive
        • Create & Add Intelligent Video Highlights to Notion
        • Create GenAI Video Engine - Notion Ideas to Youtube
        • Automatically Detect Profanity in Videos with AI - Update on Slack
        • Generate and Store YouTube Video Summaries in Notion
        • Automate Subtitle Generation for Video Libraries
        • Solve customers queries with Video Answers
      • n8n
        N8N Workflows
        • AI-Powered Meeting Intelligence: Recording to Insights Automation
        • AI Powered Dubbing Workflow for Video Content
        • Automate Subtitle Generation for Video Libraries
        • Automate Interview Evaluations with AI
        • Turn Meeting Recordings into Actionable Summaries
        • Auto-Sync Sales Calls to HubSpot CRM with AI
        • Instant Notion Summaries for Your Youtube Playlist
    • Meeting Recording SDK
    • github
      Open Source
      • llama
        LlamaIndex VideoDB Retriever
      • PromptClip: Use Power of LLM to Create Clips
      • StreamRAG: Connect ChatGPT to VideoDB
    • mcp
      VideoDB MCP Server
    • videodb
      Give your AI, Eyes and Ears
      • Building Infrastructure that “Sees” and “Edits”
      • Agents with Video Experience
      • From MP3/MP4 to the Future with VideoDB
      • Dynamic Video Streams
      • Why do we need a Video Database Now?
      • What's a Video Database ?
      • Enhancing AI-Driven Multimedia Applications
      • Beyond Traditional Video Infrastructure
    • Customer Love
    • Join us
      • videodb
        Internship: Build the Future of AI-Powered Video Infrastructure
      • Ashutosh Trivedi
        • Playlists
        • Talks - Solving Logical Puzzles with Natural Language Processing - PyCon India 2015
      • Ashish
      • Shivani Desai
      • Gaurav Tyagi
      • Rohit Garg
      • Edge of Knowledge
        • Language Models to World Models: The Next Frontier in AI
        • Society of Machines
          • Society of Machines
          • Autonomy - Do we have the choice?
          • Emergence - An Intelligence of the collective
        • Building Intelligent Machines
          • Part 1 - Define Intelligence
          • Part 2 - Observe and Respond
          • Part 3 - Training a Model
      • Updates
        • VideoDB Acquires Devzery: Expanding Our AI Infra Stack with Developer-First Testing Automation

Audio overlay + Video + Timeline

💬 Overview

Welcome to the groovy world of audio overlays with VideoDB! 🎶 In this tutorial, we're diving into the magic of adding audio overlays to your video assets. Picture this: you've got your video content all set, but it's missing that extra oomph. That's where audio overlay swoops in to save the day! With VideoDB's easy-to-use feature, you can seamlessly weave in background music, voiceovers, or funky sound effects, transforming your videos from ordinary to extraordinary. Let's crank up the volume and get ready to rock and roll!

Setup

📦 Installing packages

%pip install videodb

🔑 API Keys

Before proceeding, ensure access to
light
Get your API key from . ( Free for first 50 uploads, No credit card required ) 🎉
import videodb
import os
from getpass import getpass

# Prompt user for API key securely
api_key = getpass("Please enter your VideoDB API Key: ")
os.environ["VIDEO_DB_API_KEY"] = api_key

Steps

🌐 Step 1: Connect to VideoDB

Connect to VideoDB to establish a session for uploading and manipulating video files. Import the necessary modules from VideoDB library to access functionalities.
from videodb import connect

# Connect to VideoDB using your API key
conn = connect()
coll = conn.get_collection()

🎥 Step 2: Upload Video

Upload the video to VideoDB collection. You can upload the video asset from your local device or from a YouTube URL to upload the video from its source.
video = coll.upload(url="https://youtu.be/e49VEpWg61M")
video.play()
info
You can upload from your local file system too by passing file_path in upload()
Here’s the video we’ll be using for this tutorial:

🎥 Step 3: Upload Audio

Upload the audio file to VideoDB collection. You can upload the audio asset from your local device or from a YouTube URL to upload the audio from its source. Make sure to mention media_type if you want to use audio track of a video.
audio = coll.upload(url="https://youtu.be/_Gd8mbQ3-mI", media_type="audio")


🎼 Step 4: Create assets

Create assets for Audio and Video using VideoAsset and AudioAsset from the Editor SDK.
from videodb.editor import VideoAsset, AudioAsset

video_asset = VideoAsset(id=video.id, volume=0.5) # Reducing volume of the original video

audio_asset = AudioAsset(id=audio.id)

🎼 Step 5: Create a Timeline

Create a timeline using the Track and Clip pattern. Add the video clip and audio clip to a track, then add the track to the timeline.
from videodb.editor import Timeline, Track, Clip

# Create a new timeline
timeline = Timeline(conn)

# Create a track with video and audio clips
track = Track()

# Add video clip (full duration)
video_clip = Clip(asset=video_asset, duration=float(video.length))
track.add_clip(0, video_clip)

# Add audio overlay clip starting at 0
audio_clip = Clip(asset=audio_asset, duration=float(video.length))
track.add_clip(0, audio_clip)

timeline.add_track(track)

🪄 Final Step: Review and Share

Preview the video with the integrated voiceover to ensure it functions correctly. Once satisfied, generate a stream of the video and share the link for others to view and enjoy this wholesome creation!
from videodb import play_stream

stream = timeline.generate_stream()
play_stream(stream)

🎉 Conclusion

And there you have it, folks! We've unlocked the door to audio awesomeness with VideoDB's audio overlay feature. By seamlessly integrating background music, voiceovers, or sound effects into your videos, you're not just adding layers of sound – you're adding layers of engagement, emotion, and excitement! 🎬🎧
For more pulse-pounding adventures and support, refer to the and join the VideoDB community on or for support and collaboration.
In the meanwhile, check out the other exciting outputs generated using this tutorial and share yours in our too! We’d love to feature you here ⚡️
 
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.