SDK Reference

Video & Foreground

Run removal and handle transparent foreground assets.

Workflow

  1. Open or reference input video.
  2. Call remove background operation.
  3. Receive foreground output and metadata.
  4. Pass output to composition or download pipeline.

Node.js Example

import { RemoveBGVideoClient } from 'removebgvideo-node';

const client = new RemoveBGVideoClient(process.env.REMOVEBGVIDEO_API_KEY!);

const created = await client.createJob({
  video_url: 'https://cdn.example.com/input.mp4',
  model: 'original',
  output_format: 'webm',
  bg_type: 'transparent',
  auto_start: true,
});

const result = await client.waitForCompletion(created.id);
console.log(result.output_url);

Python Example

from removebgvideo import RemoveBGVideoClient

client = RemoveBGVideoClient(api_key='YOUR_API_KEY')

job = client.create_job(
    video_url='https://cdn.example.com/input.mp4',
    model='human',
    bg_type='transparent',
    output_format='webm',
    auto_start=True
)

result = client.wait_for_completion(job['id'])
print(result['output_url'])

Recommended SDK Usage Pattern

  1. Initialize singleton client per service process.
  2. Wrap SDK calls with your own timeout/retry decorators.
  3. Map SDK/domain errors into internal error taxonomy.
  4. Capture job_id and business context in your tracing system.

SDK Hardening Checklist

  • Add per-call timeout defaults and circuit breaking.
  • Track SDK version in logs for post-incident debugging.
  • Test SDK upgrade in staging with archived production payloads.
  • Implement fallback strategy by model and output format.

Media Input Governance

  • Validate source metadata before calling remove background.
  • Reject unsupported codecs early in pipeline.
  • Keep canonical input URL/file references for reproducibility.

When to Use Video & Foreground

Video & Foreground belongs to the SDK Reference section and covers run removal and handle transparent foreground assets.

The page is written for developers and operators who need predictable video background removal behavior in production, not just a one-off demo request.

  • Use Video & Foreground when wrapping the SDK in application services, queue workers, or automation scripts.
  • Keep SDK calls server-side so API keys are never exposed in browser code.
  • Add typed request validation around SDK inputs before passing user-provided files, URLs, or composition data.

Implementation Notes

Before you promote this workflow, test it with at least one short clip, one longer clip, and one visually difficult clip from your actual product or customer segment.

For support and debugging, persist the original input reference, selected model, output format, credit usage, and final job status alongside your internal user or project id.

  • Do not instantiate SDK clients repeatedly inside tight loops when one process-level client is enough.
  • Do not expose SDK calls that include secret keys from client-side routes.
  • Do not upgrade SDK versions without replaying archived payload fixtures in staging.

FAQ

QuestionAnswer
Is Video & Foreground required for every integration?Use it when the topic affects your setup, quality target, or operational workflow.
What should I test before going live?Verify success, failure, timeout, retry, and insufficient-credit paths with realistic video files and the same output format you plan to ship.
How does this connect to the rest of the API?Most workflows connect upload or source URL handling, job creation, status polling, output retrieval, usage tracking, and operational logging.