Video Composition via API
Automatically compose your transparent videos on custom backgrounds - all processed on our servers. No need to handle transparent videos yourself.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:- Templates - Quick presets for common layouts (social media ads, centered, PiP, fullscreen)
- 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_rightPixel Offsets
Fine-tune position with pixel offsets from the anchor:Positioning Examples
- Centered
- Top-Right Corner
- Bottom-Left
Sizing Modes
Control how your foreground is sized on the canvas.Size Mode Reference
| Mode | Description | Use Case | Parameters |
|---|---|---|---|
contain | Fit within canvas, preserve aspect ratio | Default, safe choice | None |
cover | Fill canvas, preserve aspect ratio (may crop) | Full coverage | None |
canvas_percent | Size as % of canvas | Precise control | size_percent |
px | Exact pixel dimensions | Fixed size | size_width, size_height |
scale | Scale relative to original | Proportional resize | size_width, size_height as scale factors |
fit_width | Fit to canvas width | Full width | None |
fit_height | Fit to canvas height | Full height | None |
Sizing Examples
- Contain (Default)
- 50% Canvas Size
- Exact Pixels
- Scale 75%
Background Types
Image Backgrounds
Static image backgrounds (JPEG, PNG):Video Backgrounds
Animated video backgrounds (MP4, WebM):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: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: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)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
template | string | ✅ Yes | - | Template name: ai_ugc_ad, centered, picture_in_picture, fullscreen |
background_url | string | ✅ Yes | - | URL to background image/video |
background_type | string | No | auto-detect | image or video |
background_audio_enabled | boolean | No | false | Enable background audio (video only) |
background_audio_volume | number | No | 1.0 | Audio volume (0.0 to 1.0) |
export_format | string | No | h264 | Export codec |
export_crf | integer | No | 23 | Quality (0-51, lower = better) |
Composition Object (Custom)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
background_url | string | ✅ Yes | - | URL to background |
background_type | string | ✅ Yes | - | color, image, or video |
background_color | string | Conditional | - | Hex color (if type is color) |
background_audio_enabled | boolean | No | false | Enable audio |
background_audio_volume | number | No | 1.0 | Volume (0.0-1.0) |
position | string | No | center | Anchor point |
offset_x | integer | No | 0 | Horizontal offset (px) |
offset_y | integer | No | 0 | Vertical offset (px) |
size_mode | string | No | contain | Sizing mode |
size_percent | number | Conditional | - | Size % (if mode is canvas_percent) |
size_width | number | Conditional | - | Width value |
size_height | number | Conditional | - | Height value |
opacity | number | No | 1.0 | Opacity (0.0-1.0) |
export_format | string | No | h264 | Export codec |
export_crf | integer | No | 23 | Quality (0-51) |
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 canvascanvas_percentwithsize_percent: 80- 80% of canvas- Adjust
size_percentvalue until it looks right
