From 41510eecbef088bc86b9fd0a62e4a13d9bd4470f Mon Sep 17 00:00:00 2001 From: Cherokee Date: Tue, 21 Apr 2026 18:54:20 +0800 Subject: [PATCH] feat: add ComfyUI workflow file and usage examples - video-actor-extract.json: drag-and-drop workflow for ComfyUI - Includes VideoActorExtractor + Save Text File nodes - README with parameter tuning guide - Saved to both examples/ and ComfyUI output/workflows/ --- examples/README.md | 33 ++++++++ examples/video-actor-extract.json | 131 ++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 examples/README.md create mode 100644 examples/video-actor-extract.json diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..77e7ad3 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,33 @@ +# ComfyUI 工作流示例 + +## video-actor-extract.json + +从视频中提取每个演员的完整镜头,输出绿幕抠图视频。 + +### 使用方法 + +1. 打开 ComfyUI (http://127.0.0.1:8188) +2. 将 `video-actor-extract.json` 文件**拖拽**到 ComfyUI 画布中 +3. 在 "VideoActorExtractor" 节点中设置参数: + - `video_path`: 输入视频文件路径 (必填) + - `model_path`: YOLO 模型路径,默认 `yolov8n.pt` + - `max_actors`: 最大演员数,默认 10 + - `face_threshold`: 人脸相似度阈值,默认 0.6 + - `fps_sample`: 采样帧率,默认 3 + - `min_track_length`: 最小追踪帧数,默认 5 +4. 点击 "Queue Prompt" 运行 + +### 输出 + +- 绿幕视频保存在: `ComfyUI/output/ComfyUI-VideoActorExtract/actor_X.mp4` +- JSON 信息保存在: `ComfyUI/output/ComfyUI-VideoActorExtract/actor_info.json` +- JSON 文本也会通过 "Save Text File" 节点保存为 txt 文件 + +### 参数调优 + +| 场景 | 建议参数 | +|------|---------| +| 单人舞蹈视频 | min_track_length=5, fps_sample=3 | +| 多人对话视频 | min_track_length=8, face_threshold=0.5 | +| 快速动作视频 | fps_sample=5, min_track_length=3 | +| 过滤误检 | min_track_length=10 | diff --git a/examples/video-actor-extract.json b/examples/video-actor-extract.json new file mode 100644 index 0000000..452933b --- /dev/null +++ b/examples/video-actor-extract.json @@ -0,0 +1,131 @@ +{ + "id": "video-actor-extract-workflow", + "revision": 1.0, + "last_node_id": 3, + "last_link_id": 1, + "nodes": [ + { + "id": 1, + "type": "VideoActorExtractor", + "pos": [ + 100, + 100 + ], + "size": [ + 400, + 200 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "actor_info_json", + "type": "STRING", + "links": [ + 1 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "output_dir", + "type": "STRING", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "VideoActorExtractor" + }, + "widgets_values": [ + "", + "yolov8n.pt", + 10, + 0.6, + 3, + 5 + ], + "color": "#233", + "bgcolor": "#355" + }, + { + "id": 2, + "type": "Save Text File", + "pos": [ + 600, + 100 + ], + "size": [ + 400, + 178 + ], + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "text", + "type": "STRING", + "link": 1, + "widget": { + "name": "text" + } + } + ], + "outputs": [], + "properties": { + "Node name for S&R": "Save Text File" + }, + "widgets_values": [ + "./ComfyUI/output/[time(%Y-%m-%d)]", + "actor_info", + "_", + 4, + ".txt", + "utf-8", + "" + ] + } + ], + "links": [ + [ + 1, + 1, + 0, + 2, + 0, + "STRING" + ] + ], + "groups": [ + { + "title": "Video Actor Extract", + "bounding": [ + 80, + 60, + 940, + 270 + ], + "color": "#3f789e", + "font_size": 24 + } + ], + "config": {}, + "extra": { + "ds": { + "scale": 1, + "offset": [ + 0, + 0 + ] + }, + "frontendVersion": "1.37.11", + "VHS_latentpreview": false, + "VHS_latentpreviewrate": 0, + "VHS_MetadataImage": true, + "VHS_KeepIntermediate": true + }, + "version": 0.4 +}