Nodes/BRIA AI API nodes/Bria Video Replace Background
ComfyUI Node

Bria Video Replace Background

Swap a video's backdrop without touching the subject

By Bria-AI·Created 2 years ago·Updated 3 months ago· 95
Bria Video Replace Background
  • background_image
  • result_video_url
api_keyBRIA_API_TOKEN
video_url
background_url
output_container_and_codecmp4_h264
preserve_audiotrue

Replacing the background of a video locally is one of the most compute-hungry things you can do in ComfyUI - frame-by-frame segmentation, matting, compositing, all on top of whatever else your rig is running. ReplaceVideoBackgroundNode (shown as Bria Video Replace Background) outsources the whole job to Bria's cloud. You hand it a foreground video and a new background (image or video), it returns a URL to the composited result. The killer feature: it preserves the original audio by default, so you can swap the scene behind a talking head without losing the sync.

How it works

Give it a video_url - either a local file path or a publicly accessible HTTPS URL. If it's a local path, the node uploads it to Bria's temporary S3 bucket using a presigned URL, then calls the /v2/video/edit/replace_background endpoint with your chosen background. The background can come two ways: a background_url (public image/video) or a background_image (an IMAGE wired from any other node in ComfyUI, e.g. a generated frame). If both are provided, the image wins; if neither, the node refuses to run.

The result is a polled job - background replacement on video can take a while, and the node waits up to an hour before timing out, checking every 5 seconds. What you get back is not an image tensor; it's a result_video_url string. Wire that into Bria's Preview Video node (PreviewVideoURLNode) to actually see it.

Inputs that matter

  • video_url - required. Local path or public URL of the foreground video.
  • background_url or background_image - you need one. Note that background_image only uses the first image of the batch, and it gets uploaded to Bria's temp host before processing.
  • output_container_and_codec - 9 options, default mp4_h264. The interesting one for editors is mov_proresks (ProRes-style intermediate); gif is there if you want a loopable preview. preserve_audio defaults to true - turn it off if you're compositing over footage that will get its own sound later.
  • api_key - replace the BRIA_API_TOKEN placeholder.

Installing it

Part of the BRIA AI API nodes pack (Bria-AI/ComfyUI-BRIA-API). ComfyUI Manager → search BRIA API → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Bria-AI/ComfyUI-BRIA-API

Restart ComfyUI. No model downloads, no GPU needed - but you do need a BRIA API token from platform.bria.ai and credit, because video jobs are the most expensive thing in this pack.

Common issues

Aspect ratio is the classic trap: the source code explicitly warns that if the background doesn't match the foreground's aspect ratio you'll get a BACKGROUND_ASPECT_RATIO_MISMATCH error, surfaced with both ratios so you can fix it. Also remember the background must be a public HTTPS URL if you're using the string field - file:// or a local path won't work, and a URL behind an auth wall will fail. And give it patience: this is a long-running job, not a quick node. If it times out, resubmit rather than assuming the input was wrong.

CategoryAPI Nodes

Inputs (6)

NameTypeDefaultDescription
api_keySTRINGBRIA_API_TOKEN
video_urlSTRINGLocal path or publicly accessible URL of the foreground video.
background_urloptSTRINGPublic HTTPS image or video URL, if not using background_image.
background_imageoptIMAGE
output_container_and_codecoptCOMBOmp4_h2649 options: mp4_h264, mp4_h265, webm_vp9, mov_h265, mov_proresks, mkv_h264, +3
preserve_audiooptBOOLEANtrue

Outputs (1)

NameTypeDescription
result_video_urlSTRING