Overview
The VideoBGRemover API offers multiple background options for different use cases. This guide covers the technical details of each format and how to use them in your projects.
For complete workflows and implementation examples, see the Background Removal Guide .
🎨 Color Backgrounds Replace background with solid colors using hex codes
✨ Transparent Videos Create videos with transparency for custom overlays
Quick Navigation
Color Backgrounds
Perfect for simple background replacement with solid colors. No additional processing needed - just specify a hex color code.
Simple Color Replacement
Replace the background with any solid color using hex codes:
import { VideoBGRemoverClient , Video } from '@videobgremover/sdk'
const client = new VideoBGRemoverClient ( process . env . VIDEOBGREMOVER_API_KEY !)
const video = Video . open ( 'https://example.com/video.mp4' )
// Start job with red background directly
const finalStatus = await video . removeBackground ({ client , options: {
background: { type: 'color' , color: '#FF0000' }
}})
console . log ( 'Red background video URL:' , finalStatus . processed_video_url )
Popular Colors
Color Hex Code Use Case 🔴 Red #FF0000Bold, attention-grabbing 🟢 Green #00FF00Chroma key standard 🔵 Blue #0000FFProfessional, clean ⚪ White #FFFFFFClean, minimal ⚫ Black #000000Dramatic, cinematic 🎨 Custom #7C3AEDAny hex code
For advanced compositing, custom backgrounds, and professional workflows. These formats preserve transparency for maximum flexibility.
What are transparent formats? Video files that preserve the alpha channel (transparency) so you can overlay them on custom backgrounds. However, they can be tricky to use - WebM works in Chrome but not all browsers, MOV works in Safari but requires specific codecs.
When you need custom backgrounds or advanced compositing, use transparent formats:
Format File Size Quality Use Case Compatibility WebM VP9 🟢 Small 🟢 Excellent Easy overlay, API usage Requires VP9 decoder MOV ProRes 🔴 Very Large 🟢 Perfect Large files, professional editing Video editors PNG Sequence 🔴 Very Large 🟢 Perfect GIF creation, frame-by-frame Universal Pro Bundle 🟡 Medium 🟢 Perfect Unscreen workflows, ZIP handling Universal Stacked Video 🟡 Medium 🟢 Perfect Universal, single file (top: video, bottom: mask) Universal
WebM VP9 (Recommended)
Best for: Easy overlay workflows, API usage, small file sizes
Decoder Required: WebM VP9 transparency requires libvpx-vp9 decoder. Works most of the time, but not guaranteed on all systems.
import { VideoBGRemoverClient , Video , RemoveBGOptions , Prefer } from '@videobgremover/sdk'
const client = new VideoBGRemoverClient ( process . env . VIDEOBGREMOVER_API_KEY !)
const video = Video . open ( 'https://example.com/video.mp4' )
// Remove background with WebM VP9 format
const options = new RemoveBGOptions ( Prefer . WEBM_VP9 )
const transparent = await video . removeBackground ({ client , options })
console . log ( 'Transparent WebM ready:' , transparent . primaryPath )
Using WebM Videos in Your Projects
# Overlay WebM on custom background
ffmpeg -i background.jpg -i transparent_video.webm \
-c:v libvpx-vp9 \
-filter_complex "[1:v]setpts=PTS-STARTPTS[video]; \
[0:v][video]overlay=x=(W-w)/2:y=(H-h)/2:shortest=1" \
-c:v libx264 -c:a aac output.mp4
# Important: Use -c:v libvpx-vp9 decoder to preserve alpha channels!
WebM Alpha Channel Issue: The default VP9 decoder strips alpha channels. Always use libvpx-vp9 decoder for proper transparency. If unavailable, use Stacked Video format instead.
MOV ProRes (Professional)
Best for: Professional video editing (Final Cut Pro, Premiere Pro)
import { VideoBGRemoverClient , Video , RemoveBGOptions , Prefer } from '@videobgremover/sdk'
const client = new VideoBGRemoverClient ( process . env . VIDEOBGREMOVER_API_KEY !)
const video = Video . open ( 'https://example.com/video.mp4' )
// Remove background with MOV ProRes format
const options = new RemoveBGOptions ( Prefer . MOV_PRORES )
const transparent = await video . removeBackground ({ client , options })
console . log ( 'Transparent MOV ready:' , transparent . primaryPath )
Using MOV Videos
# Overlay MOV ProRes on background
ffmpeg -i background.jpg -i transparent_video.mov \
-filter_complex "[1:v]setpts=PTS-STARTPTS[video]; [0:v][video]overlay=x=100:y=200:shortest=1" \
-c:v libx264 -c:a aac output.mp4
PNG Sequence
Best for: GIF creation, frame-by-frame editing, maximum quality
import { VideoBGRemoverClient , Video , RemoveBGOptions , Prefer } from '@videobgremover/sdk'
const client = new VideoBGRemoverClient ( process . env . VIDEOBGREMOVER_API_KEY !)
const video = Video . open ( 'https://example.com/video.mp4' )
// Remove background with PNG sequence format
const options = new RemoveBGOptions ( Prefer . PNG_SEQUENCE )
const transparent = await video . removeBackground ({ client , options })
console . log ( 'PNG sequence ready:' , transparent . primaryPath )
Using PNG Sequences
# Extract ZIP and create video from PNG sequence
unzip png_sequence.zip -d frames/
# Overlay PNG sequence on background
ffmpeg -loop 1 -i background.jpg \
-framerate 24 -i frames/frame_%04d.png \
-filter_complex "[1:v]setpts=PTS-STARTPTS[video]; \
[0:v][video]overlay=x=(W-w)/2:y=(H-h)/2:shortest=1" \
-c:v libx264 -t 5 output.mp4
Pro Bundle (Professional Workflow)
Best for: Unscreen workflows, ZIP handling, maximum flexibility
import { VideoBGRemoverClient , Video , RemoveBGOptions , Prefer } from '@videobgremover/sdk'
const client = new VideoBGRemoverClient ( process . env . VIDEOBGREMOVER_API_KEY !)
const video = Video . open ( 'https://example.com/video.mp4' )
// Remove background with Pro Bundle format
const options = new RemoveBGOptions ( Prefer . PRO_BUNDLE )
const transparent = await video . removeBackground ({ client , options })
console . log ( 'Pro Bundle ready:' , transparent . primaryPath )
Pro Bundle Contents
The Pro Bundle ZIP contains:
color.mp4 - Normalized foreground video
alpha.mp4 - 8-bit grayscale matte
audio.m4a - Audio track (if present)
manifest.json - Technical specifications
Using Pro Bundle
# Extract bundle
unzip pro_bundle.zip -d bundle/
# Combine color and alpha for transparency
ffmpeg -i bundle/color.mp4 -i bundle/alpha.mp4 \
-filter_complex "[0:v]format=rgba[color]; \
[1:v]format=gray[alpha]; \
[color][alpha]alphamerge[transparent]" \
transparent_video.mov
# Overlay on background
ffmpeg -i background.jpg -i transparent_video.mov \
-filter_complex "[1:v]setpts=PTS-STARTPTS[video]; \
[0:v][video]overlay=x=(W-w)/2:y=(H-h)/2:shortest=1" \
-c:v libx264 -c:a aac final_output.mp4
Best for: Universal compatibility, single file handling (top: video, bottom: mask)
import { VideoBGRemoverClient , Video , RemoveBGOptions , Prefer } from '@videobgremover/sdk'
const client = new VideoBGRemoverClient ( process . env . VIDEOBGREMOVER_API_KEY !)
const video = Video . open ( 'https://example.com/video.mp4' )
// Remove background with Stacked Video format
const options = new RemoveBGOptions ( Prefer . STACKED_VIDEO )
const transparent = await video . removeBackground ({ client , options })
console . log ( 'Stacked Video ready:' , transparent . primaryPath )
Stacked Video Structure
Top Half: Original video (1080x1080)
Bottom Half: Grayscale mask (1080x1080)
Total Dimensions: 1080x2160 (2:1 aspect ratio)
Using Stacked Videos
# Extract and apply mask in one command
ffmpeg -i background.jpg -i stacked_video.mp4 \
-filter_complex "
[1:v]split=2[original][mask_source];
[original]crop=1080:1080:0:0[top];
[mask_source]crop=1080:1080:0:1080,format=gray,geq='if(gte(lum(X,Y),128),255,0)'[binary_mask];
[top]format=rgba[top_rgba];
[top_rgba][binary_mask]alphamerge[masked_video];
[0:v][masked_video]overlay=x=(W-w)/2:y=(H-h)/2:shortest=1
" \
-c:v libx264 -c:a aac output.mp4
Testing Your Setup
Before processing videos, test your FFmpeg installation:
For detailed positioning and scaling techniques, see the Positioning Guide in the Video Composition section.
Test WebM Support
Python Test
Node.js Test
# Check if libvpx-vp9 decoder is available
ffmpeg -decoders | grep libvpx-vp9
# Should output:
# V..... libvpx-vp9 libvpx VP9 (codec vp9)