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
      • Audio overlay + Video + Timeline
      • Building Dynamic Video Streams with VideoDB: Integrating Custom Data and APIs
      • icon picker
        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
      • Eleven Labs x VideoDB: Adding AI Generated voiceovers to silent footage
      • 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

AI Generated Ad Films for Product Videography

Automatically Creating a professional quality advertisement from product videography B-Roll

Overview

Creating professional product advertisements typically requires a team: copywriters for the script, voice actors for the narration, and editors to stitch it all together.
VideoDB streamlines this into a single, automated workflow.
In this tutorial, we will:
Upload raw product footage (a jewelry shoot).
Analyze the visual content automatically.
Generate a professional ad script based on the visuals.
Synthesize a high-quality voiceover.
Publish the final commercial.

Setup

📦 Installing VideoDB

%pip install videodb

🔑 API Key

You only need your VideoDB API Key.
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

Implementation


🌐 Step 1: Connect to VideoDB

Establish a connection to your VideoDB project.
from videodb import connect

# Connect to VideoDB
conn = connect()
coll = conn.get_collection()

🎥 Step 2: Upload Product Footage

We’ll upload a raw video clip of a jewelry product shoot from YouTube.
# Upload a video by URL
video = coll.upload(url='https://www.youtube.com/watch?v=2DcAMbmmYNM')

🔍 Step 3: Analyze Visuals

To write a relevant script, we first need to understand what’s in the video. We’ll use index_scenes() to extract detailed descriptions of the visual content.
video.index_scenes()

Let's view the description of first scene from the video
import json
scenes = video.get_scene_index(scene_id)

print(json.dumps(scenes[0], indent=2))
Output:
{
"description": "The entire series of images presents a uniform and absolute darkness, an unbroken expanse of pure black. There are no discernible shapes, colors, or details to be found, suggesting a complete absence of light or any visual information whatsoever across the whole sequence.",
"end": 1.401,
"metadata": {},
"scene_metadata": {},
"start": 0.0
}

📝 Step 4: Generate Ad Script

Now we use VideoDB’s text generation to write the commercial. We feed the visual descriptions into the prompt to ensure the script perfectly matches the mood of the footage.
# Construct a prompt with the scene context
scene_context = "\n".join([f"- {scene['description']}" for scene in scenes])

prompt = f"""
Here is a visual description of a jewelry product video:
{scene_context}

Write a short, elegant, and luxurious voiceover script for this video advertisement.
- Tone: Sophisticated, calming, premium.
- Length: Short (approx 20 seconds of speech).
- Content: Focus on beauty, craftsmanship, and elegance.
- Format: Return ONLY the raw narration text.
"""

# Generate script
text_response = coll.generate_text(
prompt=prompt,
model_name="pro"
)

ad_script = text_response["output"]

print("--- Generated Ad Script ---")
print(ad_script)

🎙️ Step 5: Generate Voiceover

We’ll turn the script into audio.
# Generate speech directly as a VideoDB Audio Asset
audio = coll.generate_voice(
text=ad_script,
voice_name="Default"
)

🎬 Step 6: Compose the Advertisement

We’ll overlay the generated voiceover onto the original video using the Timeline editor.

from videodb.editor import Timeline, Track, Clip, VideoAsset, AudioAsset

# Create a timeline
timeline = Timeline(conn)

# 1. Video Track (Background)
video_track = Track()
video_asset = VideoAsset(id=video.id)
video_clip = Clip(asset=video_asset, duration=float(video.length))
video_track.add_clip(0, video_clip)
timeline.add_track(video_track)

# 2. Audio Track (Voiceover Overlay)
audio_track = Track()
audio_asset = AudioAsset(id=audio.id)
audio_clip = Clip(asset=audio_asset, duration=float(audio.length))
audio_track.add_clip(0, audio_clip)
timeline.add_track(audio_track)

🪄 Step 7: Review and Share

Generate the stream URL to watch your AI-created commercial.
from videodb import play_stream

stream_url = timeline.generate_stream()
play_stream(stream_url)
Output:

🎉 Conclusion

You have successfully automated the production of a product advertisement.
By replacing multiple external tools with VideoDB’s unified SDK, you can now build scalable video generation engines that turn raw footage into polished content automatically.
Explore more at .

Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.