Skip to main content

Video Composition via API

Automatically compose your transparent videos on custom backgrounds - all processed on our servers. No need to handle transparent videos yourself.
New: Try our Composition Builder to design compositions visually and export JSON.
Perfect for: Automation workflows (n8n, Zapier), applications that need final videos immediately, and users who don’t want to deal with transparent video formats.

What is API Composition?

Instead of receiving a transparent video that you need to compose yourself, the API can automatically layer your foreground on a custom background and return the final video. Two modes:
  1. Templates - Quick presets for common layouts (social media ads, centered, PiP, fullscreen)
  2. Custom - Full control over positioning, sizing, and effects

Quick Start with Templates

Templates are pre-configured compositions optimized for common use cases.

Available Templates

🎯 AI UGC Ad

Optimized for social media ads (9:16 vertical)
  • Centered foreground
  • Contain sizing
  • Perfect for TikTok, Instagram Reels

📱 Centered

Simple centered layout
  • Foreground in center
  • Fits within canvas
  • Universal use case

🖼️ Picture in Picture

Small overlay in corner
  • Bottom-right position
  • 30% canvas size
  • News, commentary style

📺 Fullscreen

Cover entire canvas
  • Foreground fills screen
  • May crop to fit
  • Immersive experience

Template Example

SDK Support Coming Soon: Python and Node.js SDK clients will support composition in an upcoming release. For now, use direct HTTP requests as shown above.

Custom Composition

Full control over positioning, sizing, and effects.

Basic Custom Composition


Positioning

Control where your foreground appears on the canvas.

Anchor Points

Choose from 9 anchor positions:
📍 top_left
📍 top_center
📍 top_right
📍 center_left
📍 center
📍 center_right
📍 bottom_left
📍 bottom_center
📍 bottom_right

Pixel Offsets

Fine-tune position with pixel offsets from the anchor:

Positioning Examples

Perfect for standard layouts

Sizing Modes

Control how your foreground is sized on the canvas.

Size Mode Reference

Sizing Examples

Foreground fits within canvas, no cropping

Background Types

Image Backgrounds

Static image backgrounds (JPEG, PNG):
Perfect for: Product showcases, simple layouts, photos

Video Backgrounds

Animated video backgrounds (MP4, WebM):
Perfect for: Dynamic content, ads, music videos
Audio Mixing: When background_audio_enabled: true, both background and foreground audio are mixed together. Adjust background_audio_volume (0.0 to 1.0) to balance the mix.

Advanced Options

Opacity Control

Control foreground transparency:
Values: 0.0 (fully transparent) to 1.0 (fully opaque) Use cases:
  • Watermarks (0.3 - 0.5)
  • Subtle overlays (0.6 - 0.8)
  • Normal composition (1.0)

Export Quality

Control output video quality:
CRF Values:
  • 18 - Very high quality (larger files)
  • 23 - High quality (default, recommended)
  • 28 - Medium quality (smaller files)
  • 32 - Lower quality (smallest files)
CRF (Constant Rate Factor): Lower values = better quality + larger files. Range: 0-51, default: 23.

Complete Examples

Social Media Ad Workflow

Python & Node.js SDK: Composition support will be added to the SDK clients in an upcoming release. Use direct HTTP requests (cURL, axios, requests, etc.) for now.

Picture-in-Picture News Style

Watermark Overlay


Parameter Reference

Composition Object (Template)

Composition Object (Custom)


Common Issues

Background URL Not Accessible

Problem: Composition fails with “Cannot download background” Solution: Ensure background URL is:
  • ✅ Publicly accessible (no authentication required)
  • ✅ Direct file link (not a webpage)
  • ✅ Supported format (JPEG, PNG for images; MP4, WebM for videos)

Audio Not Playing

Problem: Background audio is silent in final video Solution:

Foreground Too Small/Large

Problem: Foreground doesn’t fit properly Solution: Try different size modes:
  • contain - Safest, fits within canvas
  • canvas_percent with size_percent: 80 - 80% of canvas
  • Adjust size_percent value until it looks right

Position Not Accurate

Problem: Foreground not in expected position Solution: Use offset adjustments:

Next Steps

API Endpoints

Complete REST API reference

SDK Composition

Advanced local composition with multiple layers

Examples

More code examples and use cases

Output Formats

Learn about transparent video formats