Skip to main content
Open In Colab

Introduction

Adding brand elements like logo, overlays styles, elevate your video content to a new levels of professionalism. This tutorial will guide you through the process of integrating logos and custom text assets, ensuring your brand shines through in every frame. For this tutorial, we’ll add Kyvos’ branding to a video through image and text assets and see how those can be modified to enhance the content of raw footage. Although this is a quick example, the possibilities are endless! We look forward to seeing your experiments with these building blocks.

Setup

Installing packages

!pip install videodb

API Keys

Before proceeding, ensure access to VideoDB Get your API key from VideoDB Console. ( Free for first 50 uploads, No credit card required)

Implementation

Step 1: Connect to VideoDB

Begin by establishing a connection to VideoDB using your API key:
import videodb

# Set your API key
api_key = "your_api_key"

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

Step 2: Upload Video and Image Assets

Begin the branding process by uploading your video and image assets (base video and logo image) to VideoDB:
from videodb import MediaType

# Upload Video to VideoDB
video = coll.upload(url="https://youtu.be/ps3cNAcPEMs")

# Upload Image asset for branding
image = coll.upload(url="https://raw.githubusercontent.com/video-db/videodb-cookbook-assets/main/images/examples/Kyvos_Logo.png", media_type=MediaType.image)

print(f"Video ID: {video.id}")
print(f"Image ID: {image.id}")
Original Video:
Here’s the logo (image asset) we will be using for this tutorial: Kyvos logo example for brand elements tutorial

Step 3: Add Brand Elements to Video

We’ll define the text asset with styling parameters and create video/image assets for use in our timeline. The new Editor SDK uses a Track and Clip pattern for composing video. Each asset is wrapped in a Clip with duration and positioning controls.
from videodb.editor import (
    Timeline, Track, Clip,
    VideoAsset, ImageAsset, TextAsset,
    Font, Border, Shadow, Background,
    Alignment, HorizontalAlignment, VerticalAlignment, TextAlignment,
    Position, Offset, Fit)

# Create the text asset with new styling parameters
text_asset = TextAsset(
    text="Visit kyvosinsights.com today!",
    font=Font(family="PT Sans", size=38, color="#F58C29"),
    border=Border(color="#1D1C21", width=1),
    background=Background(color="#29272D", border_width=6, opacity=1.0),
    alignment=Alignment(
      horizontal=HorizontalAlignment.center,
      vertical=VerticalAlignment.top),)

# Specify the video asset (trimmed from 0 to 44 seconds)
video_asset = VideoAsset(id=video.id, start=0)
video_duration = 44

# Image asset with positioning via Clip parameters
image_asset = ImageAsset(id=image.id)

Step 4: Add Brand Elements to Video

Now we’ll bring all assets together using the Timeline, Track, and Clip pattern. The video goes on the main track, while overlays (logo and text) go on a separate track with their start times.
from videodb.editor import Timeline, Track, Clip, Position

timeline = Timeline(conn)

# Create the main video track
video_track = Track()
video_clip = Clip(asset=video_asset, duration=video_duration)
video_track.add_clip(0, video_clip)
timeline.add_track(video_track)

# Create overlay track for logo & text
overlay_track = Track()

# Add logo overlay (starts at 2.5s, duration 36s)
logo_clip = Clip(
    asset=image_asset,
    duration=36,
    fit=Fit.none,
    scale=0.15,
    position=Position.top_right,
    offset=Offset(x=-0.02, y=0.02))
overlay_track.add_clip(2.5, logo_clip)

# Add text overlay (starts at 42s, duration 2s)
text_clip = Clip(
    asset=text_asset,
    duration=2,
    position=Position.top,
    offset=Offset(y=0.05))
overlay_track.add_clip(42, text_clip)

timeline.add_track(overlay_track)

Step 5: Review and Share

Review your branded video to ensure it aligns perfectly with your brand identity, then share it with your audience:
from videodb import play_stream

# Preview the branded video
stream_url = timeline.generate_stream()
play_stream(stream_url)
Lets have a look at the output!

Conclusion

Congratulations on mastering the art of branding with VideoDB! By seamlessly integrating brand elements into your videos, you’ve enhanced their professionalism and engagement. Experiment with different branding techniques to ensure your brand shines through in every frame.

Explore Full Notebook

Open the complete implementation in Google Colab with all code examples.