Nodes/SpicyAPI/Video Character Swap · Video Edit
ComfyUI Node

Video Character Swap · Video Edit

One JSON list and the person is someone else

By spicyapi-ai·Created 21 days ago·Updated 2 days ago· 2
Video Character Swap · Video Edit
  • video_url
  • video
  • task id
◄analysis_task_id►
◄swap_targets►
◄resolution720p►
◄seed0►

The half of the job that makes the video

This is where the swap actually happens. The Video Analysis node found and numbered the people in your clip; this node replaces the ones you pick with reference photos, from $0.064 per second, up to ten people per request. Set, camera move and the original audio stay as shot - you're swapping a person, not re-shooting a scene.

It's a genuinely different proposition from the local identity stack. ReActor style pixel swaps are post-process and fast but get brittle across a moving shot; IP-Adapter-style conditioning is generative but pulls identity across the whole frame. This is a hosted, tracked swap: the tracker from the analysis pass does the heavy lifting so the face stays on the right head through motion.

How it works

Three things have to line up: the analysis task, the resolution, and the targets. The node sends spicyapi/character-swap-v1/video-edit the task id from the analyze call, your target list, and a resolution that must match. It returns an MP4 as a ComfyUI VIDEO.

Inputs and outputs

analysis_task_id (STRING) - the task id string from the analysis node. Wire it across; don't retype it. It stays usable for 24 hours, and it's the field that ties the two nodes together.

swap_targets (STRING, JSON) - a list of objects, one per target you want replaced, each with "image_urls" (one to three reference photos of the new person) and "object_index" (which detected person, 0-based, in the same order the analysis previews came back). Targets you leave out are not touched, so a two-person clip where you only want one swapped is a one-entry list. The indices correspond exactly to the numbered previews from the analysis pass - that's how you know which is which.

resolution - 480p or 720p, and it must equal the analysis value or the request is rejected. It also sets the price tier, which is why the analyze tooltip tells you to pick the resolution you actually want up front.

seed - fixed by default. Real control after generate widget; randomizing means paying again.

video_url (optional, VIDEO) - leave it out and the video from the analysis task is used. Pass it and it must be the same URL, otherwise rejection. In practice: just leave it out.

Outputs: video (VIDEO, to Save Video) and task id (STRING).

Install

Manager → search SpicyAPI, or:

cd ComfyUI/custom_nodes
git clone https://github.com/spicyapi-ai/comfyui-spicyapi

Restart. No pip dependencies and no local model - the pack's dependency list is empty and everything runs server-side, so a CPU-only machine is fine. Python 3.10+ and a current ComfyUI (V3 node API). Key in Settings > SpicyAPI, or SPICY_API_KEY on a server, then one more restart so the node list comes from your account.

Where people get burned

  • Cost scales with duration, not with how hard the shot is. $0.064/s means a 30-second clip is roughly $1.92 per person you swap territory before you've iterated. Test the whole two-node chain on a 5-second trim, and set Max cost per run to something you'd shrug at.
  • Stale task id. The most common failure. Each analysis run mints a new id; if the edit node still holds the previous one, you'll get an error or, worse, a result against the wrong video. Reconnect after every analysis pass.
  • Reference photos matter more than prompts here. Two or three well-lit, roughly frontal shots of the new person; a hat, a heavy profile or a tiny face in frame all hurt. There's no prompt field on this node - the photos are the instruction.
  • Audio survives, so verify it. The original track is preserved, which is usually what you want on a dubbed scene and occasionally not.
  • Cancelling stops you waiting, not the job. A cancelled run that finishes server-side is still charged; the result is in your console for up to 14 days.
  • Consent. Likeness swapping of real people is a legal grey zone that tightens every year, and the node has no filter for it. That part is on you.
CategorySpicyAPI/Video/Tools

Inputs (5)

NameTypeDefaultDescription
analysis_task_idSTRINGTask id returned by the video-analyze call for this clip. Its preview images are listed in the same order as object_index below, and it stays usable for 24 hours.
swap_targetsSTRINGWhich detected targets to replace and what to replace each one with. One entry per target; targets you leave out are not touched. JSON. A list of objects with "image_urls", "object_index".
resolutionCOMBO720pOutput resolution. It has to match the resolution the analyze task ran at, and it sets the price tier.
seedINT00–2147483647Same seed and settings, same result. Set 'control after generate' to randomize to get a new result on every run; every run is billed.
video_urloptVIDEOSource video. Optional: leave it out and the video from the analyze task is used. If you do pass it, it has to be the same URL, otherwise the request is rejected.

Outputs (2)

NameTypeDescription
videoVIDEO—
task idSTRINGThe SpicyAPI task id, for the console logs or support.