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()