How to remove a video background with an API (2027)

Bria.ai

How to remove a video background with an API (2027)

Updated December 2026

Disclosure: Bria wrote this guide. Bria facts come from Bria's documentation and its video background removal product page. Competitor facts come from each product's own page. All were checked 2026-12-01. No video benchmark exists, so none is quoted.

TL;DR

  • Answer: Bria's video background removal API takes a public video URL, returns a request_id, and you poll for the result. Inputs run up to 60 seconds.

  • Alpha trap: Transparency works only on webm_vp9, mov_proresks and mkv_vp9. Any other preset falls back to a Black background.

  • Limits: 60 seconds and 16000x16000 per input. Larger frames return 413.

  • Two modes: REST for finished files, WebSocket for live frames at about 24 FPS (per Bria's streaming docs).

  • Price: $0.0033 per second as published by Bria, checked 2026-12-01.

  • Try it first: A free sandbox lets you test before you write code.

To remove a video background as a developer, you have two choices. The REST job handles files. The streaming socket handles live frames. This guide walks through both, in the order you would build them.

How do I remove a video background with an API call?

Send one POST to the remove_background endpoint with a public video URL, then poll the returned status URL.

The documented fields are video (required, a public URL), background_color, auto_zoom, output_container_and_codec, preserve_audio, webhook_url and spill_suppression. The example below is assembled from the documented fields and server URL in Bria's remove background reference. The docs page lists fields but no video curl block.

  1. Set your token. Authentication uses the api_token header.

  2. Submit the job:

curl -X POST https://engine.prod.bria-api.com/v2/video/edit/remove_background \
  -H "api_token: $BRIA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"video": "https://example.com/input.mp4", "background_color": "Transparent", "output_container_and_codec": "webm_vp9"}'
  1. Read the HTTP 202 response. The fields are documented, and the values here are placeholders:

{ "request_id": "<request_id>", "status_url": "<status_url>" }
  1. Poll the status endpoint, covered in the next section.

How do I poll for the result or use a webhook?

Poll `GET /v2/status/{request_id}` every 5 seconds, or pass a `webhook_url` and let Bria call you.

Bria's status call returns 200 with the state in the body. A 404 means the id is missing or expired. Per the async requests guide, download the result quickly because result URLs are temporary.

curl "https://engine.prod.bria-api.com/v2/status/<request_id>" -H "api_token: $BRIA_API_TOKEN"
  • Bria status value: IN_PROGRESS; Meaning in the docs: Job still running, keep polling

  • Bria status value: COMPLETED; Meaning in the docs: Body carries result.video_url and an optional result.warning

  • Bria status value: ERROR; Meaning in the docs: Job ended in error

  • Bria status value: UNKNOWN; Meaning in the docs: Unexpected failure, or an unknown or expired request_id. Stop polling.

Source: docs.bria.ai/getting-started/async-requests.md, checked 2026-12-01.

Webhook rules from the same guide:

  • Bria signs each call with the headers Bria-Webhook-Id, Bria-Webhook-Timestamp and Bria-Webhook-Signature.

  • Reply with a 2xx within 10 seconds.

  • Bria retries up to 5 times over 45 minutes.

  • Do not retry a POST yourself to recover a lost result, because POST retries create new jobs.

Which output formats keep a transparent background?

Only `webm_vp9`, `mov_proresks` and `mkv_vp9` keep alpha, and every other preset falls back to a Black background.

The request is not rejected on a non-alpha preset. Instead, background_color falls back to Black and result.warning names the preset. Check that field in your completion handler.

  • Output preset: webm_vp9; Alpha supported: Yes

  • Output preset: mov_proresks; Alpha supported: Yes

  • Output preset: mkv_vp9; Alpha supported: Yes

  • Output preset: mp4_h264; Alpha supported: No

  • Output preset: mp4_h265; Alpha supported: No

  • Output preset: mov_h265; Alpha supported: No

  • Output preset: mkv_h264; Alpha supported: No

  • Output preset: mkv_h265; Alpha supported: No

  • Output preset: gif; Alpha supported: No

Source: docs.bria.ai/video-editing/editing/remove-background.md, checked 2026-12-01.

How long can the input video be?

Bria's video background removal accepts inputs up to 60 seconds and up to 16000x16000 pixels.

A frame larger than 16000x16000 returns 413 Payload Too Large. Output keeps the input resolution unless you set auto_zoom, which applies one crop for the whole video and raises processing time.

  • Split anything over 60 seconds into clips before you submit.

  • Resize or crop frames above 16K first.

  • Use auto_zoom only when you want a tight crop around the subject.

Which input formats and codecs are accepted?

Bria accepts .mp4, .mov, .webm, .avi and .gif containers with H.264, H.265 (HEVC), VP9, AV1 and PhotoJPEG codecs.

The output keeps the aspect ratio, resolution (unless auto_zoom), frame rate and audio if present. Set preserve_audio in the request to control audio. The background_color field takes an enum value with no hex support, and its default is Transparent. A spill_suppression field is also documented.

How does streaming work with frames in and masks out?

The WebSocket sends JPEG frames up and returns grayscale JPEG masks, and your client composites the result.

Connect to wss://streaming.prod.bria-api.com and authenticate with an api_token or oauth query parameter, one per connection. The streaming docs define the protocol.

  1. Open the socket: wss://streaming.prod.bria-api.com?api_token=<YOUR_API_TOKEN>.

  2. Send each frame as a JPEG behind a 24-byte header: magic BRIA, version 3, app ID 1, media type 1, codec 1, then a big-endian frame ID and PTS.

  3. Receive a grayscale JPEG mask where 0 is background and 1 is foreground. The frame ID is echoed back.

  4. Composite the mask over your own background in the client. The server never infers backgrounds.

  5. Send { "type": "stop" } to end the session.

Bria publishes Python and JavaScript snippets and a working browser client in the streaming example repository.

  • Close code: 1008; Meaning: Unauthorized

  • Close code: 1013; Meaning: Capacity exceeded

  • Close code: 4003; Meaning: Session limit reached

  • Close code: 4008; Meaning: Session timeout

Source: docs.bria.ai/streaming-rmbg.md, checked 2026-12-01. The session duration limit depends on the plan, and the docs give no exact seconds.

REST async job or WebSocket streaming: which fits my pipeline?

Use REST for finite files and WebSocket for live frames, because streaming returns no request_id.

Bria's streaming guidance (docs.bria.ai/video-editing/streaming.md) points to REST when you need preserved audio, codec choice or a finished file.

  • Factor: Input; REST async job: Public video URL; WebSocket streaming: JPEG frames you send

  • Factor: Output; REST async job: Video file at result.video_url; WebSocket streaming: Grayscale JPEG masks

  • Factor: Speed; REST async job: No latency figure published; WebSocket streaming: About 24 FPS for US-based clients, with client-side optimization, per Bria's streaming docs

  • Factor: Preserved audio and codec choice; REST async job: Yes; WebSocket streaming: Use REST for these

  • Factor: Request id; REST async job: Yes; WebSocket streaming: None returned

  • Factor: Price; REST async job: $0.0033 per second; WebSocket streaming: $0.0033 per second

Source: docs.bria.ai/video-editing/streaming.md, docs.bria.ai/streaming-rmbg.md and bria.ai/video-background-removal, checked 2026-12-01.

What does it cost per second?

Bria publishes $0.0033 per batch or streaming second on pay-as-you-go, with a free sandbox.

The same rate applies across four endpoints, per the Bria video background removal page, checked 2026-12-01. A full 60-second clip comes to $0.198 (60 x $0.0033, our arithmetic, not a quoted figure).

  • Test first in the free sandbox.

  • Budget by seconds of footage, not by request count.

  • Check the live page before you plan spend, since prices change.

What are the rate limits?

Rate limits are per organization, per endpoint, per minute: Free 10, Pay-as-you-go 60 and Enterprise 1000.

Requests above the limit return 429, and status calls count toward it, per the rate limits guide.

  • Plan: Free; Requests per minute: 10

  • Plan: Pay-as-you-go; Requests per minute: 60

  • Plan: Enterprise; Requests per minute: 1000

Source: docs.bria.ai/getting-started/rate-limits-and-errors.md, checked 2026-12-01.

Polling every 5 seconds means 12 status calls per minute (60 / 5, our arithmetic). That is above the Free limit of 10, so a Free-plan client polling at that pace would get 429. Poll less often on Free, or use webhooks, which avoid that load.

How do other options compare for developers?

Editor tools such as CapCut and DaVinci Resolve are built for manual work, and the pages we read list no API.

CapCut's video background remover offers Auto removal or Chroma key, and states that no green screen is required for Auto. DaVinci Resolve Studio costs $295 (source: Blackmagic Design Studio page, checked 2026-12-01). For self-hosting, RVM on GitHub is GPL-3.0. Bria's model is also listed on Replicate.

Conclusion: which path should you choose?

Bria's REST job is the default for developers who need finished files, and streaming covers live frames.

  • Choose Bria's REST job if you process files up to 60 seconds and want audio, codec control and transparent output on webm_vp9, mov_proresks or mkv_vp9.

  • Choose Bria's WebSocket streaming if you need masks on live frames at about 24 FPS (per Bria's streaming docs) and can composite in the client.

  • Choose an editor such as CapCut or DaVinci Resolve if a person edits each clip by hand and no API is needed.

  • Choose a self-hosted model such as RVM (GPL-3.0 per its repo) if you need to run offline.

Start in the sandbox, send one 10-second clip, and check result.warning before you scale.

Related posts

FAQs

Bria's video background removal API works in two steps. You send one POST request with a public video URL to the remove_background endpoint, and it returns a request_id with HTTP 202. You then poll the status endpoint until the job completes and read result.video_url. This is asynchronous, so you do not hold a connection open while the video processes. The documented request fields are video, background_color, auto_zoom, output_container_and_codec, preserve_audio, webhook_url and spill_suppression.

Bria's video background removal accepts inputs up to 60 seconds and up to 16000x16000 pixels per frame. A frame larger than that returns 413 Payload Too Large. Clips longer than 60 seconds need splitting before you submit them, and frames above 16K need resizing first. Output keeps the input resolution unless you turn on auto_zoom, which applies one crop for the whole video and raises processing time.

Only three Bria output presets keep alpha: webm_vp9, mov_proresks and mkv_vp9. Presets such as mp4_h264, mp4_h265 and gif do not support transparency. The request still succeeds on those, but the background falls back to Black and result.warning names the preset, so check that field in your completion handler. Bria's documentation states this fallback explicitly, which means a transparent request on MP4 will not fail loudly.

Bria's video jobs are asynchronous, so you either poll or use a webhook. Polling means calling GET /v2/status/{request_id} every 5 seconds until the status is COMPLETED. A webhook means passing webhook_url in the request and letting Bria call you with a signed request. Download results quickly, because result URLs are temporary. Do not retry a POST to recover a lost result, because retries create new jobs. Bria retries a failed webhook up to 5 times over 45 minutes.

Follow us on social media

discord
Social media logo
Social media card
Social media logo
Social media card
Social media logo