Documentation Index
Fetch the complete documentation index at: https://docs.videobgremover.com/llms.txt
Use this file to discover all available pages before exploring further.
Basic Examples
Simple Background Replacement
Remove background and overlay on a colored background.
// 1. Remove background from video
import { VideoBGRemoverClient, Video, Background, Composition, EncoderProfile, Anchor, SizeMode } from '@videobgremover/sdk'
const client = new VideoBGRemoverClient('your_api_key')
const video = Video.open('input.mp4')
const transparent = await video.removeBackground(client)
// 2. Add to colored background
const background = Background.fromColor('#FF6B35', 1920, 1080, 30)
const comp = new Composition(background)
comp.add(transparent, 'main').at(Anchor.CENTER).size(SizeMode.CONTAIN)
// 3. Export
await comp.toFile('output.mp4', EncoderProfile.h264())
console.log('✅ Background replaced!')
AI UGC Ads
AI Avatar on Video Background
Create professional UGC ads with AI avatars positioned bottom-right.
import {
VideoBGRemoverClient, Video, Background, Composition,
EncoderProfile, Anchor, SizeMode, RemoveBGOptions, Prefer
} from '@videobgremover/sdk'
async function createAIUGCAd() {
// 1. Remove background from AI actor
const client = new VideoBGRemoverClient('your_api_key')
const aiActor = Video.open('ai_actor_video.mp4')
const options = new RemoveBGOptions(Prefer.WEBM_VP9)
const transparentActor = await aiActor.removeBackground(client, options)
// 2. Create video background
const background = Background.fromVideo('product_showcase.mp4')
const comp = new Composition(background)
// 3. Position AI avatar bottom-right (35% of canvas)
comp.add(transparentActor, 'ai_avatar')
.at(Anchor.BOTTOM_RIGHT, -50, -50) // 50px from edges
.size(SizeMode.CANVAS_PERCENT, { percent: 35 })
.opacity(0.95) // Slight transparency for polish
// 4. Export for ads
await comp.toFile('ai_ugc_ad.mp4', EncoderProfile.h264({
crf: 20,
preset: 'medium'
}))
console.log('✅ AI UGC ad created: ai_ugc_ad.mp4')
}
createAIUGCAd()
Dynamic Social Media Content
Interactive Positioning with Transparency Effects
Create engaging social media content with moving elements and transparency changes.
async function createDynamicSocialContent() {
// 1. Process content video
const client = new VideoBGRemoverClient('your_api_key')
const contentVideo = Video.open('dynamic_content.mp4')
const transparent = await contentVideo.removeBackground(client)
// 2. Create vertical background video (9:16 for social)
const background = Background.fromVideo('trending_background.mp4')
const comp = new Composition(background)
// 3. Dynamic positioning sequence
// 0-3s: Bottom-right with transparency
comp.add(transparent.subclip(0, 3), 'phase1')
.start(0).duration(3)
.at(Anchor.BOTTOM_RIGHT, -30, -30)
.size(SizeMode.CANVAS_PERCENT, { percent: 40 })
.alpha(true)
.opacity(0.8)
// 3-6s: Top-left without transparency
comp.add(transparent.subclip(3, 6), 'phase2')
.start(3).duration(3)
.at(Anchor.TOP_LEFT, 30, 30)
.size(SizeMode.CANVAS_PERCENT, { percent: 35 })
.alpha(false)
.opacity(1.0)
// 6-9s: Center with partial transparency
comp.add(transparent.subclip(6, 9), 'phase3')
.start(6).duration(3)
.at(Anchor.CENTER)
.size(SizeMode.CANVAS_PERCENT, { percent: 50 })
.alpha(true)
.opacity(0.6)
// 9-12s: Bottom-left with full transparency
comp.add(transparent.subclip(9, 12), 'phase4')
.start(9).duration(3)
.at(Anchor.BOTTOM_LEFT, 30, -30)
.size(SizeMode.CANVAS_PERCENT, { percent: 45 })
.alpha(true)
.opacity(0.9)
// 4. Export for social media
await comp.toFile('dynamic_social_content.mp4', EncoderProfile.h264({
crf: 25,
preset: 'fast'
}))
console.log('✅ Dynamic social content created')
}
createDynamicSocialContent()
Next Steps
📖 API Reference
Complete API documentation for all classes and methods
🎬 Background Removal Guide
Detailed guide to background removal options and formats
🎨 Video Composition Guide
Learn advanced composition techniques and effects