> ## Documentation Index
> Fetch the complete documentation index at: https://docs.videodb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Brand Elements

> Add logos, text overlays, and custom styling

<a href="https://colab.research.google.com/github/video-db/videodb-cookbook/blob/main/examples/Adding_Brand_Elements.ipynb" target="_blank">
  <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" noZoom />
</a>

### 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.

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/ps3cNAcPEMs" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

## Setup

### Installing packages

<CodeGroup>
  ```python Python theme={null}
  !pip install videodb
  ```

  ```javascript Node.js theme={null}
  npm install videodb
  ```
</CodeGroup>

### API Keys

Before proceeding, ensure access to [VideoDB](https://videodb.io)

Get your API key from [VideoDB Console](https://console.videodb.io/). ( 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:

<CodeGroup>
  ```python Python theme={null}
  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()
  ```

  ```javascript Node.js theme={null}
  import { connect } from 'videodb';

  const conn = await connect({ apiKey: process.env.VIDEO_DB_API_KEY });
  const coll = await conn.getCollection();
  ```
</CodeGroup>

### 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:

<CodeGroup>
  ```python Python theme={null}
  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}")
  ```

  ```javascript Node.js theme={null}
  import { MediaType } from 'videodb';

  // Upload Video to VideoDB
  const video = await coll.uploadURL({ url: "https://youtu.be/ps3cNAcPEMs" });

  // Upload Image asset for branding
  const image = await coll.uploadURL({
    url: "https://raw.githubusercontent.com/video-db/videodb-cookbook-assets/main/images/examples/Kyvos_Logo.png",
    mediaType: MediaType.image
  });

  console.log(`Video ID: ${video.id}`);
  console.log(`Image ID: ${image.id}`);
  ```
</CodeGroup>

Original Video:

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/ps3cNAcPEMs" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

Here's the logo (image asset) we will be using for this tutorial:

<img src="https://mintcdn.com/videodb/6KL5X6-sIPSRpEUt/assets/examples/kyvos.webp?fit=max&auto=format&n=6KL5X6-sIPSRpEUt&q=85&s=2c993650d5e7d8fa3db7c8f271df5152" style={{width: "300px", height: "auto"}} alt="Kyvos logo example for brand elements tutorial" width="997" height="277" data-path="assets/examples/kyvos.webp" />

### 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.

<CodeGroup>
  ```python Python theme={null}
  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)
  ```

  ```javascript Node.js theme={null}
  import {
    EditorTimeline, Track, Clip,
    EditorVideoAsset, EditorImageAsset, EditorTextAsset,
    Font, Border, Background,
    Alignment, HorizontalAlignment, VerticalAlignment, Position, Offset
  } from 'videodb';

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

  // Specify the video asset (trimmed from 0 to 44 seconds)
  const videoAsset = new EditorVideoAsset({ id: video.id, start: 0 });
  const videoDuration = 44;

  // Image asset with positioning via Clip parameters
  const imageAsset = new EditorImageAsset({ id: image.id });
  ```
</CodeGroup>

### 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.

<CodeGroup>
  ```python Python theme={null}
  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)
  ```

  ```javascript Node.js theme={null}
  const timeline = new EditorTimeline(conn);

  // Create the main video track
  const videoTrack = new Track();
  const videoClip = new Clip({ asset: videoAsset, duration: videoDuration });
  videoTrack.addClip(0, videoClip);
  timeline.addTrack(videoTrack);

  // Create overlay track for logo & text
  const overlayTrack = new Track();

  // Add logo overlay (starts at 2.5s, duration 36s)
  const logoClip = new Clip({
    asset: imageAsset,
    duration: 36,
    scale: 0.15,
    position: Position.topRight,
    offset: new Offset({ x: -0.02, y: 0.02 })
  });
  overlayTrack.addClip(2.5, logoClip);

  // Add text overlay (starts at 42s, duration 2s)
  const textClip = new Clip({
    asset: textAsset,
    duration: 2,
    position: Position.top,
    offset: new Offset({ y: 0.05 })
  });
  overlayTrack.addClip(42, textClip);

  timeline.addTrack(overlayTrack);
  ```
</CodeGroup>

### Step 5: Review and Share

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

<CodeGroup>
  ```python Python theme={null}
  from videodb import play_stream

  # Preview the branded video
  stream_url = timeline.generate_stream()
  play_stream(stream_url)
  ```

  ```javascript Node.js theme={null}
  // Preview the branded video
  const streamUrl = await timeline.generateStream();
  console.log(streamUrl);
  ```
</CodeGroup>

Lets have a look at the output!

<iframe className="w-full aspect-video rounded-xl" src="https://play.videodb.io/v1/ce541325-9903-4aca-b786-4c85bb17820d.m3u8" title="Branded Video Output" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

### 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.

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/ka8x7nFChN8" title="Branding Tutorial" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

<Card icon="notebook" title="Explore Full Notebook" href="https://colab.research.google.com/github/video-db/videodb-cookbook/blob/main/examples/Adding_Brand_Elements.ipynb">
  Open the complete implementation in Google Colab with all code examples.
</Card>

## Related Tutorials

<CardGroup cols={2}>
  <Card title="Intro/Outro" icon="film" href="/examples-and-tutorials/programmatic-editing/intro-outro">
    Add opening and closing sequences to your videos
  </Card>

  <Card title="Audio Overlay" icon="volume-2" href="/examples-and-tutorials/programmatic-editing/audio-overlay">
    Add background music and sound effects to your compositions
  </Card>
</CardGroup>
