Skip to content

Shenrui-Ma/video-regen-recipes / templates/character-short/bit-by-bit-heartache

bit-by-bit-heartache

Verified

用角色参考图在本机制作 Heartache 连续动作配乐短片.

FileKindSize
.gitignoreother430 B
LICENSEother1.1 KB
LICENSES.mdmarkdown1.4 KB
README.mdmarkdown9.3 KB
SKILL.mdskill md7.3 KB
assets/README.mdmarkdown4.9 KB
assets/default/manifest.jsonconfig3.8 KB
assets/runtime-assets.jsonconfig5.5 KB
profile.jsonconfig3.8 KB
prompts/ref2va.template.txtmarkdown1.6 KB
prompts/yaoguang.historical.txtmarkdown5.0 KB
references/background-removal.mdmarkdown5.5 KB
references/changelog.mdmarkdown916 B
references/character-input.mdmarkdown4.7 KB
references/deployment.mdmarkdown4.9 KB
references/editing.mdmarkdown3.7 KB
references/environment.lock.jsonconfig1.5 KB
references/first-segment-validation.jsonconfig1.8 KB
references/generation.mdmarkdown3.8 KB
references/media-preflight.mdmarkdown4.2 KB
references/native-continuation.mdmarkdown17.8 KB
references/node-sources.jsonconfig6.7 KB
references/node-sources.mdmarkdown3.8 KB
references/package-verification.jsonconfig1.7 KB
references/reference-check.jsonconfig968 B
references/reproduction.mdmarkdown10.1 KB
references/validation.mdmarkdown2.6 KB
references/workflow-recovery.mdmarkdown2.2 KB
references/workflow.lock.jsonconfig1.2 KB
references/yaoguang-run.jsonconfig7.4 KB
scripts/character/prepare_character.pyscript6.5 KB
scripts/distribution/fetch_assets.pyscript5.8 KB
scripts/distribution/package_skill.pyscript5.6 KB
scripts/plan_segments.pyscript3.4 KB
scripts/prepare_driver.pyscript5.2 KB
scripts/render_default.pyscript5.5 KB
scripts/runtime/graphs.pyscript11.3 KB
scripts/runtime/heartache.pyscript14.6 KB
scripts/runtime/local_io.pyscript3.3 KB
scripts/runtime/media.pyscript13.2 KB
scripts/runtime/run_segment.pyscript13.3 KB
sources.mdmarkdown2.4 KB
tests/test_background_removal.pyscript2.6 KB
tests/test_character_input.pyscript12.2 KB
tests/test_default.pyscript879 B
tests/test_distribution.pyscript12.3 KB
tests/test_media_preflight.pyscript2.1 KB
tests/test_prepare_driver.pyscript1.9 KB
tests/test_release_review.pyscript1.7 KB
tests/test_reproduction.pyscript1.9 KB
tests/test_runtime_cli.pyscript11.3 KB
tests/test_runtime_graph.pyscript4.8 KB
tests/test_runtime_io.pyscript2.1 KB
tests/test_runtime_media.pyscript10.2 KB
tests/test_runtime_runner.pyscript1.6 KB
tests/test_segment_plan.pyscript3.4 KB
tests/test_skill_contract.pyscript1.6 KB
workflows/continue.editor.jsonconfig23.8 KB
workflows/first.editor.jsonconfig19.8 KB
workflows/node-schema.jsonconfig22.2 KB
workflows/provenance.jsonconfig911 B

references/background-removal.md

View on GitHub
# 可选去背景:RMBG → alpha/mask → 明确RGB底色

仅在用户要求去背景、或同意纠正参考图背景带入视频时使用。已有透明立绘直接进入第三步;普通RGB参考不默认去背景。此步骤不生成新的角色图。

## 1. 节点与模型

- 节点来源、固定版本、模型哈希和许可说明都在 Toolkit 的[去背景工作流包](https://github.com/Shenrui-Ma/shenrui-comfyui-toolkit/tree/667eafd/workflows/images/rmbg-2-alpha/)(`README.md`、`dependencies.lock.json`)。使用公开`1038lab/ComfyUI-RMBG`仓库的`bd509b4750c81221b938684489c87187b0172208`;不要沿用已经失效的旧组织地址。
- 模型为`1038lab/RMBG-2.0`,revision为`1cd4787601caeb4c8e826dba7ea8e2163b5208df`,放在`ComfyUI/models/RMBG/RMBG-2.0/`。四个文件的URL、SHA256、字节数见该包的 `dependencies.lock.json`。本包不含权重或第三方模型代码。
- 节点GPL-3.0和模型使用权分开确认。先阅读[BRIA官方模型页](https://huggingface.co/briaai/RMBG-2.0)及适用许可,确认非商用/商用范围。镜像能下载不表示获得模型授权;官方页面需登录时由用户完成登录,不从镜像绕过授权。
- 模型含自定义Python代码,固定SHA不等于安全审计。安装前审阅固定版本代码、requirements与许可证,避免改动正在生成的共享环境。

仅在用户允许安装、目标实例没有活动任务且目录不存在时,在新实例的ComfyUI目录执行:

```bash
git clone https://github.com/1038lab/ComfyUI-RMBG.git custom_nodes/ComfyUI-RMBG
git -C custom_nodes/ComfyUI-RMBG checkout --detach bd509b4750c81221b938684489c87187b0172208
# python必须是该实例的虚拟环境解释器
python -m pip install -r custom_nodes/ComfyUI-RMBG/requirements.txt
```

已有节点先读取版本/本地修改/加载错误,不覆盖或重置。安装完在获准启动的独立实例中检查`/object_info/RMBG`;不要为当前生成任务重启共享服务。H3主安装流程不自动安装RMBG。

确认模型授权后,按该包 `dependencies.lock.json` 里记录的固定 revision 取这四个文件,逐个核对字节数与 SHA-256:

```
https://huggingface.co/1038lab/RMBG-2.0/resolve/1cd4787601caeb4c8e826dba7ea8e2163b5208df/config.json
https://huggingface.co/1038lab/RMBG-2.0/resolve/1cd4787601caeb4c8e826dba7ea8e2163b5208df/birefnet.py
https://huggingface.co/1038lab/RMBG-2.0/resolve/1cd4787601caeb4c8e826dba7ea8e2163b5208df/BiRefNet_config.py
https://huggingface.co/1038lab/RMBG-2.0/resolve/1cd4787601caeb4c8e826dba7ea8e2163b5208df/model.safetensors
```

已有文件不同就停下核对,不覆盖;网络中断保留未完成文件供核查。该模型约885MB,不属于轻量Skill包。

## 2. 独立去背景图

用 Toolkit 的[去背景包](https://github.com/Shenrui-Ma/shenrui-comfyui-toolkit/tree/667eafd/workflows/images/rmbg-2-alpha/api.template.json)里的参数化API图(`api.template.json`);本模板不再自带这张图。可用ComfyUI原生节点手动建立等价图:

- `LoadImage` → `RMBG.image`。
- RMBG参数:`model=RMBG-2.0`、`sensitivity=1.0`、`process_res=1024`、`mask_blur=0`、`mask_offset=0`、`invert_output=false`、`refine_foreground=false`、`background=Alpha`、`background_color=#FFFFFF`。
- 输出0 `IMAGE` → 第一个`SaveImage`,保存透明人物。
- 输出2 `MASK_IMAGE` → 第二个`SaveImage`,保存可查看的mask。输出1是`MASK`,不能直接接`SaveImage.images`。

Agent通过API执行时:将原参考图保存至任务独立的ComfyUI input子目录(或`/upload/image`且`overwrite=false`);根据上传回执把图的 `{{input_image}}` 绑定为真实input相对路径,把 `{{alpha_prefix}}` 与 `{{mask_prefix}}` 绑定为新的任务相对前缀。拒绝绝对路径和`..`。核对当前`/object_info`的参数及三个输出槽位,确认JSON不再含占位符。

提交前将完整图、源图SHA与新UUID写入任务独立attempt记录并落盘,再以`{prompt: 图, prompt_id: UUID}`向`/prompt`提交一次。保存实际返回ID,查询`/history/ID`直至该ID完成;响应不明先查原ID的queue/history,不重新提交。按history的两个SaveImage输出记录,从`/view?filename=...&subfolder=...&type=output`取回PNG并记录SHA。不得猜输出文件名、拿历史图冒充本次结果。

这是独立图片分割任务,不连接H3 Sampler或生成控制器。节点/权重缺失时先处理依赖,不能先提交H3并期待自动修好参考图。

## 3. 合成真正送入H3的RGB图

```bash
python3 scripts/character/prepare_character.py \
  --image ./rmbg-output/alpha.png --background '#FFFFFF' \
  --out-dir ./character-white
```

保留原图、alpha、mask以及`character-white/provenance.json`。用Pillow读回alpha/mask,检查尺寸一致、alpha既有前景又有透明像素、mask非全黑或全白;检查输出`character.png`为RGB,尺寸与经过EXIF方向处理的原图一致。把这些原件SHA和实际RGB SHA与本次prompt记录放在同一任务目录。机械检查不能证明头发、配饰和衣服边缘已经理想。

将**`character-white/character.png`**传给H3的`--character-image`。透明PNG的隐藏RGB可能仍有原背景,绝不能仅`convert('RGB')`或把保存alpha等同于H3已经使用白底。原图、mask、alpha留作证据,不作为H3主参考。

首段对照时沿用原seed、驱动、107帧和20步,仅变参考预处理,且先取得对照生成授权。已有两次首段试跑的技术证据见[first-segment-validation.json](first-segment-validation.json);新机器安装和整片续接仍需实测。
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall