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
      • 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
      • icon picker
        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

Fit & Position: Aspect Ratio Control

When your asset’s dimensions don’t match the timeline resolution, you run into the classic aspect ratio problem - like trying to fit a vertical phone video into a horizontal landscape frame, or vice versa. The fit parameter determines how to handle this mismatch (crop it? add black bars? stretch it?), while position and offset let you control exactly where the content sits on screen.

Fit Modes

The fit parameter determines how an asset scales to match the timeline resolution.

Fit.crop (default)

Scales asset to fill viewport while maintaining aspect ratio
Edges are cropped if aspect ratios differ
This is the default because it creates clean, full-frame compositions without black bars. The tradeoff is you might lose some content at the edges, but everything stays proportional and the frame stays filled.

Fit.contain

Scales asset to fit entirely within viewport while maintaining aspect ratio
May add letterboxing (black bars) if aspect ratios differ
Use this when you need to guarantee that all of your content is visible, even if it means having black bars on the sides or top and bottom. Nothing gets cropped, but you sacrifice the full-frame look.

Fit.cover

Stretches asset to fill viewport, ignoring aspect ratio
May cause distortion
This mode stretches the content to fill the frame regardless of proportions. You’ll rarely need this unless you specifically want the stretched effect, or you’re working with content that already matches your timeline’s aspect ratio exactly.

Fit.none

Preserves original pixel dimensions
No scaling applied
This keeps your asset at its exact original size, which is useful for things like logos, overlays, or picture-in-picture effects where you want pixel-perfect control. The content appears at its native resolution regardless of timeline size.

Code Example

from videodb.editor import Fit

clip = Clip(
asset=VideoAsset(id=video.id),
duration=10,
fit=Fit.crop # or Fit.contain, Fit.cover, Fit.none
)
Note: You can also use fit=None (Python None) which is equivalent to Fit.none.

Position

The position parameter places the asset in one of 9 preset zones on the viewport. Think of your screen divided into a 3x3 grid - you can anchor your content to any of these zones, from corners to edges to dead center.
Position.top_left Position.top Position.top_right
Position.left Position.center Position.right
Position.bottom_left Position.bottom Position.bottom_right
Example with Position.left

Code Example

from videodb.editor import Position

clip = Clip(
asset=VideoAsset(id=video.id),
duration=10,
position=Position.top_right,
fit=None
)

Offset

The offset parameter provides fine-grained position control using relative coordinates. Sometimes the 9 preset zones aren’t quite right - maybe you want something centered but nudged slightly to the left, or positioned with a specific margin. That’s where offset comes in, letting you tweak positions with precision.
Example Offset(x=-0.25)

Code Example

from videodb.editor import Offset

clip = Clip(
asset=VideoAsset(id=video.id),
duration=10,
position=Position.center,
offset=Offset(x=0.15, y=0.1) # x: horizontal, y: vertical
)
Coordinate System:
x : Horizontal shift (-1.0 to 1.0)
Positive values move right
Negative values move left
y : Vertical shift (-1.0 to 1.0)
Positive values move down
Negative values move up
Values are relative to viewport dimensions
image.png
Example: offset=Offset(x=0.1, y=0) on a 1080px wide viewport moves the clip 108px to the right.

Parameter Reference

Parameter
Type
Description
fit
Fit
Scaling behavior : Fit.crop, Fit.contain, Fit.cover, Fit.none
position
Position
Anchor point : Position.top_left, Position.center, etc. (9 options)
offset
Offset
Fine-tuning position with x/y coordinates
There are no rows in this table
from videodb.editor import Clip, VideoAsset, Fit, Position, Offset

clip = Clip(
asset=VideoAsset(id=video.id),
duration=10,
fit=Fit.crop,
position=Position.right,
offset=Offset(x=-0.1, y=0)
)

Next Steps:

For hands-on experimentation with all fit modes and position options, see:

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