Background replace
Pricing: Background replace
Keep the people in a video exactly as they are, with their voices, and replace everything around them with the scene in a plate image. Returns an mp4.
POST https://api.happypony.io/api/v1/jobs/background-replace
GET https://api.happypony.io/api/v1/jobs/:requestId/status
GET https://api.happypony.io/api/v1/jobs/:requestId
PUT https://api.happypony.io/api/v1/jobs/:requestId/cancel
POST with Content-Type: application/json. The clip and the plate are fetched and stored when the request is created, so a URL that cannot be fetched is a 400 invalid_media and nothing is charged. Unknown fields are a 400.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
video_url |
string | yes | http(s) URL of the source clip (mp4, mov, webm or mkv, up to 200 MB). | |
plate_url |
string | yes | http(s) URL of the plate: one image of the new scene with nobody in it, in the clip's aspect. The plate decides the scene. | |
scene |
string | unless prompt |
The new scene in plain literal English, up to 4000 characters, with no negations. | |
people |
string | no | Who stands there and what they do, in English. | |
prompt |
string | no | built from scene |
Your exact prompt, up to 4000 characters. Needs variant M or R and must name the plate as <Picture 1>; with M, also the clip as <Video 1>. |
variant |
string | no | auto |
M reads the people as a matte: fine hair, held objects, night scenes. R regenerates from the plate and the words: daylight scenes with no thin parts, a person absent or small at the start. auto picks R when the kept people cover under 2% or are absent at the start, otherwise M. |
duration_seconds |
integer | no | 10 |
1 to 20 (15 at 768). Only the first duration_seconds of the clip are processed. |
resolution |
string | no | 480 |
480 or 768. |
upscale |
boolean | no | false |
Force the canvas even when the clip already fits it. |
seed |
integer | no | worker default | The same inputs and seed give the same result. |
keep |
object | no | every person, up to 8 | What is kept from the source, applied in this order. people: "all", "largest" or a count 1 to 8. concepts: up to 4 { "text", "expand"? } (0 to 32 px) that stay too. frames: [start_s, end_s], keep only in this range. subtract: up to 4 { "text", "expand"? } (0 to 64 px, default 18) taken back out. boxes: up to 16 { "rect": [x, y, w, h], "set": 0 or 1, "frames"? }, rect in 0–1 fractions, set 0 keeps the source there and 1 regenerates it. |
paste_back |
object | no | erode 1, feather 3 |
How the people are pasted back: erode 0 to 8, feather 0 to 16. It cannot be turned off. |
grade |
object | no | off | Adjusts the kept area to the new light. { "auto": true, "strength"?: 0..1 } or manual gain, gamma, lift_bottom. |
lipsync |
boolean | no | false |
Pin the audio rows to the source audio. |
dry_run |
boolean | no | false |
true: no render, only a mask preview. Read mask_preview (green = the regenerated cells; everything else is kept) and stats. |
The source audio is kept. Completed requests have video_url and files, including the comparison sheet and mask preview; dry_run results have mask_preview, stats and files instead.