SDK Reference

Composition

Compose transparent foreground with color/image/video backgrounds.

Composition Model

A composition is a timeline/canvas with layered assets and export settings.

Core Operations

  • Add layer
  • Set anchor/position
  • Scale/fit mode
  • Set output format
  • Export to file/cloud

Best Practices

  • Use consistent FPS across layers when possible.
  • Keep source and target resolutions compatible.
  • Avoid repeated lossy encoding.

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.

Composition Testing Strategy

  1. Snapshot-test key composition templates on fixed fixtures.
  2. Check foreground anchor behavior across multiple aspect ratios.
  3. Run regression tests after FFmpeg or SDK upgrades.

When to Use Composition

Composition belongs to the SDK Reference section and covers compose transparent foreground with color/image/video backgrounds.

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 Composition 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 Composition 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.