videodb
VideoDB Documentation
videodb
VideoDB Documentation
Quick Start Guide

icon picker
Ref: TextAsset

TextAsset API Reference

Overlaying Text elements on a video is very useful in multiple scenarios. VideoDB’s Asset class let’s you define a text asset with rich style with many fonts, colors and positions to add into your stream in real time.
This document provides an API Reference to interface with the TextStyle class.
empty-flag
Checkout to dive deep into the outputs of these parameters

Import

Import TextStyle from videodb.asset
from videodb import connect
from videodb.asset import TextAsset, TextStyle


Usage

Here's how you might typically use the TextStyle class in your application:

from videodb import connect
from videodb.asset import TextAsset, TextStyle

conn = connect()
coll = conn.get_collection()
video = coll.get_video("MY_VIDEO_ID")

text_asset = TextAsset(
text="THIS IS A TEXT Asset",
duration=5,
style=TextStyle(
font = "Inter",
fontsize = 50,
fontcolor = "#FFCFA5",
)
)




TextStyle


font

The font family used for the text.
Default: "Sans"
Type: str
info
Checkout List of Supported Fonts

fontsize

The size of the text
Default: 24
Type: int

fontcolor

The color of the font.
Default: black
Type: str
info
See also Color Format & recognized colors

alpha

Transparency level of the text.
The value can be a number between 0.0 and 1.0
Default: 1.0 (fully opaque)
Type: float

borderw

The width of the border around the text.
Default: 0
Type: float

bordercolor

The color of the text border.
Default: black
Type: str

x

The horizontal position of the text, can be a expression(str) or fixed value(float)
They are relative to the left border of Video
Default: "(w -tw )/2"
Type: int or str
info
To learn more about expressions, checkout Using Expression in Position


y

The horizontal position of the text, can be a expression(str) or fixed value(float)
They are relative to the left border of Video
Default: "(h -th )/2"
Type: int or str

info
To learn more about expressions, checkout Using Expression in Position

box

Whether to draw a background box around the text.
Default: True
Type: bool

boxw

The width of the background box.
Default: 0
Type: float

boxh

The height of the background box.
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.