Loading...
Loading...
通过`runcomfy` CLI在RunComfy平台上将人脸/角色替换到视频或图片中。该功能可调用多种社区模型接口:Wan 2-2 Animate(音频驱动的角色动画+身份替换)、GPT Image 2 Edit(通过参考构图对静态图片进行单次精准人脸替换)、Nano Banana Edit(批量保留身份的替换)、Flux Kontext(单参考高保真局部人脸编辑)以及Kling 2-6 Motion Control Pro(将动作从一个表演转移到目标角色上)。系统会根据用户的实际需求选择合适的模型——比如是单张静态图还是视频、全角色替换还是仅人脸替换、对话场景还是无声动作场景。当用户提出诸如"face swap"、"swap face"、"deepfake"、"face replacement"、"character swap"、"head swap"、"把X的脸放到Y身上"、"让这个视频的主角变成X"、"替换视频中的演员"、"替换照片里的角色"、"deepfake视频"、"ReActor替代方案"等明确要求替换身份的指令时,该功能会触发。
npx skill4agent add prime-skills/runcomfy-agent-skills face-swapruncomfy# 1. 安装(详情查看runcomfy-cli技能)
npm i -g @runcomfy/cli # 或: npx -y @runcomfy/cli --version
# 2. 登录
runcomfy login # 或在CI环境中:export RUNCOMFY_TOKEN=<token>
# 3. 执行替换
runcomfy run <vendor>/<model>/<endpoint> \
--input '{"image_url": "...", "identity_url": "..."}' \
--output-dir ./outruncomfy-clinpx skills add agentspace-so/runcomfy-agent-skills --skill face-swap -gcommunity/wan-2-2-animate/apiRunComfy的特色接口,位于。音频驱动的全身角色动画:只需提供新身份的参考图片+音频,即可生成角色做出对应动作的视频。 适用场景:将场景中的角色替换为新身份、配音片段,支持风格化和写实风格。 不适用场景:需要保留源视频特定动作的情况——请使用Kling Motion Control。/feature/character-swap
kling/kling-2-6/motion-control-pro输入参考表演视频+目标角色图片,生成目标角色做出参考动作的视频。人脸替换是附带效果。 适用场景:需要将源视频的动作/镜头调度精准保留到新角色上;能很好地处理风格化角色。 不适用场景:无需保留动作的简单“替换视频中的人脸”——请使用Wan 2-2 Animate。
google/nano-banana-2/edit默认保留身份,每次调用支持1–20张输入图片,遵循空间语言指令。 适用场景:需在多帧中一致替换同一身份(如SKU展示图、A/B变体图、叙事面板)。将身份参考图设为,其余为待替换场景图。 不适用场景:需要精准多参考构图的情况(如“将图1的脸放到图2的身体上”)——请使用GPT Image 2 Edit。image_urls[0]
openai/gpt-image-2/edit支持最多10张参考图片,支持多语言图片内文本改写,遵循精准的构图指令。 适用场景:需要将肖像中的精准人脸替换到场景图的主视觉图中,且需明确角色分配(如“图1”“图2”);保留姿势、光线、背景仅替换人脸。 不适用场景:1-20张批量替换——请使用Nano Banana 2 Edit。
blackforestlabs/flux-1-kontext/pro/edit单源图片,单条声明式指令,最大程度保留除目标编辑部分外的所有内容。 适用场景:“保留姿势、服装、发型、光线、背景,仅将脸改为[文字描述]”——无需提供新身份的参考图片。 不适用场景:批量替换、多参考替换,或已有目标人脸参考图片的情况——请使用Nano Banana 2 Edit或GPT Image 2 Edit。
音频驱动的换脸说话头像(同时替换人脸和声音)? → 使用技能——OmniHuman可同时处理人脸和音频。ai-avatar-video
runcomfy run community/wan-2-2-animate/api \
--input '{
"image_url": "https://your-cdn.example/new-character.png",
"audio_url": "https://your-cdn.example/voiceover.mp3"
}' \
--output-dir ./outruncomfy run kling/kling-2-6/motion-control-pro \
--input '{
"reference_video_url": "https://your-cdn.example/source-performance.mp4",
"character_image_url": "https://your-cdn.example/target-character.png"
}' \
--output-dir ./outopenai/gpt-image-2/edit| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 是 | — | 构图指令;明确标注参考图角色 |
| string[] | 是 | — | 最多10个HTTPS参考链接。图1为主要参考图 |
| enum | 否 | | |
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "Replace the face of the person in image 1 with the face from image 2. Preserve image 1 pose, clothing, lighting, and background exactly. Match skin tone and lighting to image 1.",
"images": [
"https://your-cdn.example/target-scene.jpg",
"https://your-cdn.example/identity-face.jpg"
],
"size": "auto"
}' \
--output-dir ./out"image 1""image 2""Preserve pose, clothing, lighting, and background exactly. Replace only the face.""match skin tone and lighting to image 1"google/nano-banana-2/editruncomfy run google/nano-banana-2/edit \
--input '{
"prompt": "Replace the face in each image with the face shown in the first image. Keep all other elements — pose, clothing, lighting, background — unchanged.",
"image_urls": [
"https://your-cdn.example/identity-ref.jpg",
"https://your-cdn.example/scene-1.jpg",
"https://your-cdn.example/scene-2.jpg",
"https://your-cdn.example/scene-3.jpg"
],
"aspect_ratio": "auto",
"resolution": "1K"
}' \
--output-dir ./outaspect_ratioresolutionimage-editblackforestlabs/flux-1-kontext/pro/editruncomfy run blackforestlabs/flux-1-kontext/pro/edit \
--input '{
"prompt": "Keep pose, clothing, hair, lighting, and background exactly. Change only the face to that of a 35-year-old woman with high cheekbones, hazel eyes, and a small scar above the right eyebrow.",
"image": "https://your-cdn.example/scene.jpg"
}' \
--output-dir ./outimage_urls[0]aspect_ratioresolutionimages: [场景图, 人脸图]ai-avatar-video/models/feature/character-swap/models/feature/lip-syncbest-image-editing-modelskling| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI参数错误 |
| 65 | 输入JSON错误/schema不匹配 |
| 69 | 上游服务5xx错误 |
| 75 | 可重试:超时/429错误 |
| 77 | 未登录或令牌被拒绝 |
runcomfy run <model_id>.runcomfy.net.runcomfy.com--output-dirnpm i -g @runcomfy/clinpx -y @runcomfy/cliruncomfy login~/.config/runcomfy/token.jsonRUNCOMFY_TOKEN--inputmodel-api.runcomfy.net*.runcomfy.net*.runcomfy.comallowed-tools: Bash(runcomfy *)runcomfy <subcommand>runcomfy-cliai-avatar-videoai-video-generationvideo-editimage-editlipsync