The VideoBGRemover API offers multiple background options for different use cases. This guide covers all formats and shows you how to use transparent videos in your own projects.
🎨 Color Backgrounds
Replace background with solid colors using hex codes
✨ Transparent Videos
Create videos with transparency for custom overlays
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:
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.
Here’s a complete example showing how to process a video and overlay it on a custom background:
Copy
Ask AI
#!/bin/bashAPI_KEY="vbr_your_api_key_here"VIDEO_FILE="input.mp4"BACKGROUND="custom_background.jpg"# 1. Process video with APIecho "Processing video..."JOB_RESPONSE=$(curl -s -X POST https://api.videobgremover.com/v1/jobs \ -H "X-Api-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d "{\"filename\": \"$VIDEO_FILE\", \"content_type\": \"video/mp4\"}")JOB_ID=$(echo $JOB_RESPONSE | jq -r '.id')UPLOAD_URL=$(echo $JOB_RESPONSE | jq -r '.upload_url')# Upload videocurl -X PUT "$UPLOAD_URL" -H "Content-Type: video/mp4" --data-binary @"$VIDEO_FILE"# Start processing with WebM formatcurl -s -X POST https://api.videobgremover.com/v1/jobs/$JOB_ID/start \ -H "X-Api-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "background": { "type": "transparent", "transparent_format": "webm_vp9" } }'# Wait for completion and get resultwhile true; do STATUS=$(curl -s -X GET https://api.videobgremover.com/v1/jobs/$JOB_ID/status \ -H "X-Api-Key: $API_KEY" | jq -r '.status') if [ "$STATUS" = "completed" ]; then WEBM_URL=$(curl -s -X GET https://api.videobgremover.com/v1/jobs/$JOB_ID/status \ -H "X-Api-Key: $API_KEY" | jq -r '.processed_video_url') break fi sleep 10done# 2. Download transparent videocurl -o transparent_video.webm "$WEBM_URL"# 3. Overlay on custom backgroundffmpeg -i "$BACKGROUND" -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 final_result.mp4echo "✅ Final video created: final_result.mp4"
This guide covers everything you need to work with transparent videos from the VideoBGRemover API. Choose the format that best fits your workflow and follow the examples for your preferred tool!