Guides

Composition JSON

Reference schema for composition payload used by /v1/jobs/{job_id}/start.

Schema Overview

Composition controls foreground placement on the output canvas.

Use this payload when you want deterministic positioning and model-safe defaults for enterprise workflows.

{
  "composition": {
    "canvas": { "width": 1920, "height": 1080 },
    "foreground": {
      "anchor": "center",
      "scale": 1,
      "offset": { "x": 0, "y": 0 }
    }
  }
}

Field Reference

FieldTypeDescription
canvas.widthnumberOutput width in pixels
canvas.heightnumberOutput height in pixels
foreground.anchorstringAnchor point, e.g. center, top-left
foreground.scalenumberForeground scaling ratio
foreground.offset.x/ynumberPixel offset from anchor

Background Types

typeRequired FieldsNotes
transparentnoneUse WebM/MOV/GIF/WebP/PNG sequence for alpha
colorcolor (hex or RGB normalized)Best for MP4 exports
imageimage_urlMatch aspect ratio to avoid stretching

Full Start Payload Example

curl -X POST https://api.removebgvideo.com/v1/jobs/{JOB_ID}/start \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "pro",
    "text_prompt": "person, clothing accessories, glowing ring",
    "background": { "type": "transparent" },
    "composition": {
      "canvas": { "width": 1920, "height": 1080 },
      "foreground": {
        "anchor": "center",
        "scale": 1,
        "offset": { "x": 0, "y": 0 }
      }
    }
  }'

Quality Guardrails

  • Prefer representative source clips when tuning model defaults.
  • Keep input compression moderate to preserve edge details.
  • Use explicit output format policy for transparent vs non-transparent workflows.
  • Run A/B validation with the same clip set before changing defaults.

Implementation Checklist

  1. Define payload schema validation in backend before forwarding requests.
  2. Store model/output_format/background settings with each job record.
  3. Add internal quality review for difficult scenes (hair, glass, motion blur).
  4. Create runbook entries for model-specific failure cases.

Anchor Behavior Guidance

AnchorTypical UseRisk
centerGeneral subject centeringCan crop tall subjects if scale too high
top-leftUI-like fixed placementLess natural for portrait content
bottom-centerTalking head over lower thirdCan overlap caption area

Composition Validation Rules

  • Require canvas width/height > 0 and reasonable aspect ratio.
  • Constrain scale to safe range (e.g. 0.1 - 3.0) in your backend.
  • Clamp offset values to avoid moving subject outside visible frame.

When to Use Composition JSON

Composition JSON belongs to the Guides section and covers reference schema for composition payload used by /v1/jobs/{job_id}/start.

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 this guide when composition json decisions affect output quality, processing cost, or user-facing workflow design.
  • Test guidance on representative videos rather than only short demo clips.
  • Record the chosen model, background, output format, and quality notes with each processed job for later debugging.

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 judge quality from a single frame; inspect motion, hair, hands, transparent edges, and fast turns.
  • Do not compare model outputs using different source compression levels.
  • Do not change production defaults without a rollback path and a known sample set.

FAQ

QuestionAnswer
Is Composition JSON 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.