From 7be3ba33d72b7d985fae38870d1c6fb998d60874 Mon Sep 17 00:00:00 2001 From: dseditor Date: Mon, 7 Jul 2025 08:13:40 +0800 Subject: [PATCH] change nodes --- Example/MultiTalk16VFI.json | 3824 +++++++++++++++++++++++++++++++++++ nodes.py | 271 ++- pyproject.toml | 2 +- 3 files changed, 3943 insertions(+), 154 deletions(-) create mode 100644 Example/MultiTalk16VFI.json diff --git a/Example/MultiTalk16VFI.json b/Example/MultiTalk16VFI.json new file mode 100644 index 0000000..c4bfb17 --- /dev/null +++ b/Example/MultiTalk16VFI.json @@ -0,0 +1,3824 @@ +{ + "id": "206247b6-9fec-4ed2-8927-e4f388c674d4", + "revision": 0, + "last_node_id": 181, + "last_link_id": 318, + "nodes": [ + { + "id": 110, + "type": "easy forLoopStart", + "pos": [ + 120, + 270 + ], + "size": [ + 270, + 138 + ], + "flags": {}, + "order": 29, + "mode": 0, + "inputs": [ + { + "name": "initial_value1", + "shape": 7, + "type": "*", + "link": null + }, + { + "name": "total", + "type": "INT", + "widget": { + "name": "total" + }, + "link": 216 + }, + { + "name": "initial_value2", + "type": "*", + "link": null + } + ], + "outputs": [ + { + "name": "flow", + "shape": 5, + "type": "FLOW_CONTROL", + "links": [ + 199 + ] + }, + { + "name": "index", + "type": "INT", + "links": [ + 206 + ] + }, + { + "name": "value1", + "type": "*", + "links": [ + 229 + ] + }, + { + "name": "value2", + "type": "*", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-easy-use", + "ver": "71c7865d2d3c934ccb99f24171e08ae5a81148ac", + "Node name for S&R": "easy forLoopStart", + "widget_ue_connectable": { + "total": true + } + }, + "widgets_values": [ + 3 + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 124, + "type": "WanVideoUni3C_embeds", + "pos": [ + 1230, + -50 + ], + "size": [ + 270, + 146 + ], + "flags": {}, + "order": 36, + "mode": 0, + "inputs": [ + { + "name": "controlnet", + "type": "WANVIDEOCONTROLNET", + "link": 219 + }, + { + "name": "render_latent", + "type": "LATENT", + "link": 220 + }, + { + "name": "render_mask", + "shape": 7, + "type": "MASK", + "link": null + } + ], + "outputs": [ + { + "name": "uni3c_embeds", + "type": "UNI3C_EMBEDS", + "links": [ + 218 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "2da36b7fdaa9da9cf38785116917adf3974387da", + "Node name for S&R": "WanVideoUni3C_embeds", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 1, + 0, + 1 + ] + }, + { + "id": 125, + "type": "WanVideoUni3C_ControlnetLoader", + "pos": [ + 1180, + -270 + ], + "size": [ + 322.4781188964844, + 154 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "compile_args", + "shape": 7, + "type": "WANCOMPILEARGS", + "link": null + } + ], + "outputs": [ + { + "name": "controlnet", + "type": "WANVIDEOCONTROLNET", + "links": [ + 219 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "2da36b7fdaa9da9cf38785116917adf3974387da", + "Node name for S&R": "WanVideoUni3C_ControlnetLoader", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "Wan21_Uni3C_controlnet_fp16.safetensors", + "fp16", + "fp8_e4m3fn", + "offload_device", + "sageattn" + ] + }, + { + "id": 128, + "type": "RepeatImageBatch", + "pos": [ + 880, + -250 + ], + "size": [ + 270, + 58 + ], + "flags": {}, + "order": 27, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 223 + }, + { + "name": "amount", + "type": "INT", + "widget": { + "name": "amount" + }, + "link": 224 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 222 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.41", + "Node name for S&R": "RepeatImageBatch", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 1 + ] + }, + { + "id": 11, + "type": "LoadWanVideoT5TextEncoder", + "pos": [ + 100, + -510 + ], + "size": [ + 377.1661376953125, + 130 + ], + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "wan_t5_model", + "type": "WANTEXTENCODER", + "slot_index": 0, + "links": [ + 15 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "LoadWanVideoT5TextEncoder", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "umt5-xxl-enc-fp8_e4m3fn.safetensors", + "bf16", + "offload_device", + "disabled" + ], + "color": "#332922", + "bgcolor": "#593930" + }, + { + "id": 28, + "type": "WanVideoDecode", + "pos": [ + 950, + -570 + ], + "size": [ + 315, + 198 + ], + "flags": {}, + "order": 39, + "mode": 0, + "inputs": [ + { + "name": "vae", + "type": "WANVAE", + "link": 235 + }, + { + "name": "samples", + "type": "LATENT", + "link": 90 + } + ], + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "slot_index": 0, + "links": [ + 227, + 230 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "WanVideoDecode", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + false, + 272, + 272, + 144, + 128, + "default" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 38, + "type": "WanVideoVAELoader", + "pos": [ + 90, + -660 + ], + "size": [ + 372.7727966308594, + 82 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "vae", + "type": "WANVAE", + "slot_index": 0, + "links": [ + 221, + 234, + 235 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "WanVideoVAELoader", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "Wan2_1_VAE_bf16.safetensors", + "bf16" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 137, + "type": "LayerUtility: PurgeVRAM", + "pos": [ + -1260, + -870 + ], + "size": [ + 270, + 82 + ], + "flags": {}, + "order": 24, + "mode": 4, + "inputs": [ + { + "name": "anything", + "type": "*", + "link": 242 + } + ], + "outputs": [], + "properties": { + "cnr_id": "comfyui_layerstyle", + "ver": "3bfe8e435d167b4a5bf08716729f89802dbbaa6f", + "Node name for S&R": "LayerUtility: PurgeVRAM", + "widget_ue_connectable": {} + }, + "widgets_values": [ + true, + true + ], + "color": "rgba(38, 73, 116, 0.7)" + }, + { + "id": 151, + "type": "VHS_VideoCombine", + "pos": [ + 2510, + -380 + ], + "size": [ + 214.7587890625, + 456.8357849121094 + ], + "flags": {}, + "order": 54, + "mode": 4, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 300 + }, + { + "name": "audio", + "shape": 7, + "type": "AUDIO", + "link": 257 + }, + { + "name": "meta_batch", + "shape": 7, + "type": "VHS_BatchManager", + "link": null + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": null + }, + { + "name": "frame_rate", + "type": "FLOAT", + "widget": { + "name": "frame_rate" + }, + "link": 263 + } + ], + "outputs": [ + { + "name": "Filenames", + "type": "VHS_FILENAMES", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "a7ce59e381934733bfae03b1be029756d6ce936d", + "Node name for S&R": "VHS_VideoCombine", + "widget_ue_connectable": {} + }, + "widgets_values": { + "frame_rate": 8, + "loop_count": 0, + "filename_prefix": "TTS/STEP4", + "format": "video/nvenc_hevc-mp4", + "pix_fmt": "yuv420p", + "bitrate": 10, + "megabit": true, + "save_metadata": true, + "pingpong": false, + "save_output": true, + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "STEP4_00002-audio.mp4", + "subfolder": "TTS", + "type": "output", + "format": "video/nvenc_hevc-mp4", + "frame_rate": 50, + "workflow": "STEP4_00002.png", + "fullpath": "C:\\Users\\dseditor\\CUI\\ComfyUI\\output\\TTS\\STEP4_00002-audio.mp4" + } + } + } + }, + { + "id": 147, + "type": "VHS_LoadVideoPath", + "pos": [ + 1950, + -360 + ], + "size": [ + 231.8896484375, + 286 + ], + "flags": {}, + "order": 45, + "mode": 4, + "inputs": [ + { + "name": "meta_batch", + "shape": 7, + "type": "VHS_BatchManager", + "link": null + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": null + }, + { + "name": "video", + "type": "STRING", + "widget": { + "name": "video" + }, + "link": 253 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 254 + ] + }, + { + "name": "frame_count", + "type": "INT", + "links": null + }, + { + "name": "audio", + "type": "AUDIO", + "links": [ + 257 + ] + }, + { + "name": "video_info", + "type": "VHS_VIDEOINFO", + "links": [ + 262 + ] + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "a7ce59e381934733bfae03b1be029756d6ce936d", + "Node name for S&R": "VHS_LoadVideoPath", + "widget_ue_connectable": {} + }, + "widgets_values": { + "video": "", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1, + "format": "AnimateDiff", + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "", + "type": "path", + "format": "video/", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1 + } + } + } + }, + { + "id": 150, + "type": "UpscaleModelLoader", + "pos": [ + 2210, + -240 + ], + "size": [ + 270, + 58 + ], + "flags": {}, + "order": 3, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "UPSCALE_MODEL", + "type": "UPSCALE_MODEL", + "links": [ + 255 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.41", + "Node name for S&R": "UpscaleModelLoader", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "RealESRGAN_x2.pth" + ] + }, + { + "id": 131, + "type": "DisplayAny", + "pos": [ + -640, + -1040 + ], + "size": [ + 270, + 100 + ], + "flags": {}, + "order": 30, + "mode": 0, + "inputs": [ + { + "name": "input", + "type": "*", + "link": 236 + } + ], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": null + } + ], + "title": "LoopSize", + "properties": { + "cnr_id": "comfyui_essentials", + "ver": "9d9f4bedfc9f0321c19faf71855e228c93bd0dc9", + "Node name for S&R": "DisplayAny", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "raw value" + ] + }, + { + "id": 63, + "type": "WanVideoImageToVideoEncode", + "pos": [ + -310, + -1050 + ], + "size": [ + 330, + 410 + ], + "flags": {}, + "order": 33, + "mode": 0, + "inputs": [ + { + "name": "vae", + "type": "WANVAE", + "link": 234 + }, + { + "name": "clip_embeds", + "shape": 7, + "type": "WANVIDIMAGE_CLIPEMBEDS", + "link": 82 + }, + { + "name": "start_image", + "shape": 7, + "type": "IMAGE", + "link": 233 + }, + { + "name": "end_image", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "name": "control_embeds", + "shape": 7, + "type": "WANVIDIMAGE_EMBEDS", + "link": null + }, + { + "name": "temporal_mask", + "shape": 7, + "type": "MASK", + "link": null + }, + { + "name": "extra_latents", + "shape": 7, + "type": "LATENT", + "link": null + }, + { + "name": "add_cond_latents", + "shape": 7, + "type": "ADD_COND_LATENTS", + "link": null + }, + { + "name": "width", + "type": "INT", + "widget": { + "name": "width" + }, + "link": 109 + }, + { + "name": "height", + "type": "INT", + "widget": { + "name": "height" + }, + "link": 110 + }, + { + "name": "num_frames", + "type": "INT", + "widget": { + "name": "num_frames" + }, + "link": 111 + }, + { + "name": "realisdance_latents", + "shape": 7, + "type": "REALISDANCELATENTS", + "link": null + } + ], + "outputs": [ + { + "name": "image_embeds", + "type": "WANVIDIMAGE_EMBEDS", + "links": [ + 87 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "WanVideoImageToVideoEncode", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": { + "width": true, + "height": true, + "num_frames": true + } + }, + "widgets_values": [ + 832, + 480, + 81, + 0.030000000000000006, + 1, + 0.9440000000000002, + true, + false, + false + ], + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 65, + "type": "WanVideoClipVisionEncode", + "pos": [ + -610, + -600 + ], + "size": [ + 327.5999755859375, + 262 + ], + "flags": {}, + "order": 28, + "mode": 0, + "inputs": [ + { + "name": "clip_vision", + "type": "CLIP_VISION", + "link": 70 + }, + { + "name": "image_1", + "type": "IMAGE", + "link": 232 + }, + { + "name": "image_2", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "name": "negative_image", + "shape": 7, + "type": "IMAGE", + "link": null + } + ], + "outputs": [ + { + "name": "image_embeds", + "type": "WANVIDIMAGE_CLIPEMBEDS", + "links": [ + 82 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "WanVideoClipVisionEncode", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 1, + 1, + "center", + "average", + true, + 0, + 0.5000000000000001 + ], + "color": "#233", + "bgcolor": "#355" + }, + { + "id": 59, + "type": "CLIPVisionLoader", + "pos": [ + -950, + -370 + ], + "size": [ + 315, + 58 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "CLIP_VISION", + "type": "CLIP_VISION", + "links": [ + 70 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.26", + "Node name for S&R": "CLIPVisionLoader", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "clip_vision_h.safetensors" + ], + "color": "#233", + "bgcolor": "#355" + }, + { + "id": 71, + "type": "DownloadAndLoadWav2VecModel", + "pos": [ + 470, + -270 + ], + "size": [ + 355.20001220703125, + 106 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "wav2vec_model", + "type": "WAV2VECMODEL", + "links": [] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "df95c85283d7625fbdf664d0133a2e1c114ba14a", + "Node name for S&R": "DownloadAndLoadWav2VecModel", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "TencentGameMate/chinese-wav2vec2-base", + "fp16", + "main_device" + ], + "color": "#323", + "bgcolor": "#535" + }, + { + "id": 155, + "type": "MultiTalkModelLoader", + "pos": [ + 100, + -250 + ], + "size": [ + 350, + 82 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "model", + "type": "MULTITALKMODEL", + "links": [ + 265 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "2da36b7fdaa9da9cf38785116917adf3974387da", + "Node name for S&R": "MultiTalkModelLoader", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "WanVideo_2_1_Multitalk_14B_fp8_e4m3fn.safetensors", + "fp16" + ] + }, + { + "id": 130, + "type": "easy batchAnything", + "pos": [ + 450, + 420 + ], + "size": [ + 140, + 46 + ], + "flags": {}, + "order": 40, + "mode": 0, + "inputs": [ + { + "name": "any_1", + "type": "*", + "link": 229 + }, + { + "name": "any_2", + "type": "*", + "link": 230 + } + ], + "outputs": [ + { + "name": "batch", + "type": "*", + "links": [ + 228 + ] + } + ], + "properties": { + "cnr_id": "comfyui-easy-use", + "ver": "de92038f88317699f314be85e5c7af84f1ab9c3a", + "Node name for S&R": "easy batchAnything", + "widget_ue_connectable": {} + }, + "widgets_values": [] + }, + { + "id": 121, + "type": "easy forLoopEnd", + "pos": [ + 770, + 260 + ], + "size": [ + 163.08984375, + 86 + ], + "flags": {}, + "order": 41, + "mode": 0, + "inputs": [ + { + "name": "flow", + "shape": 5, + "type": "FLOW_CONTROL", + "link": 199 + }, + { + "name": "initial_value1", + "shape": 7, + "type": "*", + "link": 228 + }, + { + "name": "initial_value2", + "type": "*", + "link": 227 + }, + { + "name": "initial_value3", + "type": "*", + "link": null + } + ], + "outputs": [ + { + "name": "value1", + "type": "*", + "links": [ + 231 + ] + }, + { + "name": "value2", + "type": "*", + "links": [] + }, + { + "name": "value3", + "type": "*", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-easy-use", + "ver": "71c7865d2d3c934ccb99f24171e08ae5a81148ac", + "Node name for S&R": "easy forLoopEnd", + "widget_ue_connectable": {} + }, + "widgets_values": [], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 138, + "type": "LoadAudio", + "pos": [ + -1990, + -1060 + ], + "size": [ + 274.080078125, + 136 + ], + "flags": {}, + "order": 7, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "AUDIO", + "type": "AUDIO", + "links": [ + 243 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.41", + "Node name for S&R": "LoadAudio", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "normalsoft.flac", + null, + null + ] + }, + { + "id": 140, + "type": "SaveAudio", + "pos": [ + -1250, + -1040 + ], + "size": [ + 250, + 112 + ], + "flags": {}, + "order": 25, + "mode": 4, + "inputs": [ + { + "name": "audio", + "type": "AUDIO", + "link": 245 + } + ], + "outputs": [], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.41", + "Node name for S&R": "SaveAudio", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "audio/ComfyUI" + ] + }, + { + "id": 153, + "type": "VHS_VideoInfoSource", + "pos": [ + 2220, + -50 + ], + "size": [ + 239.6552734375, + 106 + ], + "flags": {}, + "order": 48, + "mode": 4, + "inputs": [ + { + "name": "video_info", + "type": "VHS_VIDEOINFO", + "link": 262 + } + ], + "outputs": [ + { + "name": "fps🟨", + "type": "FLOAT", + "links": [ + 263 + ] + }, + { + "name": "frame_count🟨", + "type": "INT", + "links": null + }, + { + "name": "duration🟨", + "type": "FLOAT", + "links": null + }, + { + "name": "width🟨", + "type": "INT", + "links": null + }, + { + "name": "height🟨", + "type": "INT", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "a7ce59e381934733bfae03b1be029756d6ce936d", + "Node name for S&R": "VHS_VideoInfoSource", + "widget_ue_connectable": {} + }, + "widgets_values": {} + }, + { + "id": 30, + "type": "VHS_VideoCombine", + "pos": [ + 1530, + -250 + ], + "size": [ + 320, + 334 + ], + "flags": {}, + "order": 42, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 231 + }, + { + "name": "audio", + "shape": 7, + "type": "AUDIO", + "link": 308 + }, + { + "name": "meta_batch", + "shape": 7, + "type": "VHS_BatchManager", + "link": null + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": null + }, + { + "name": "frame_rate", + "type": "FLOAT", + "widget": { + "name": "frame_rate" + }, + "link": 190 + } + ], + "outputs": [ + { + "name": "Filenames", + "type": "VHS_FILENAMES", + "links": [ + 264, + 278 + ] + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "0a75c7958fe320efcb052f1d9f8451fd20c730a8", + "Node name for S&R": "VHS_VideoCombine", + "widget_ue_connectable": { + "frame_rate": true + } + }, + "widgets_values": { + "frame_rate": 23, + "loop_count": 0, + "filename_prefix": "TTSFT/STEP2", + "format": "video/h264-mp4", + "pix_fmt": "yuv420p", + "crf": 19, + "save_metadata": true, + "trim_to_audio": false, + "pingpong": false, + "save_output": true, + "videopreview": { + "hidden": true, + "paused": false, + "params": { + "filename": "STEP2_00015-audio.mp4", + "subfolder": "TTSFT", + "type": "output", + "format": "video/h264-mp4", + "frame_rate": 16, + "workflow": "STEP2_00015.png", + "fullpath": "C:\\Users\\dseditor\\CUI\\ComfyUI\\output\\TTSFT\\STEP2_00015-audio.mp4" + } + } + }, + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 154, + "type": "LayerUtility: PurgeVRAM", + "pos": [ + 700, + 410 + ], + "size": [ + 270, + 82 + ], + "flags": {}, + "order": 43, + "mode": 0, + "inputs": [ + { + "name": "anything", + "type": "*", + "link": 264 + } + ], + "outputs": [], + "properties": { + "cnr_id": "comfyui_layerstyle", + "ver": "3bfe8e435d167b4a5bf08716729f89802dbbaa6f", + "Node name for S&R": "LayerUtility: PurgeVRAM", + "widget_ue_connectable": {} + }, + "widgets_values": [ + true, + true + ], + "color": "rgba(38, 73, 116, 0.7)" + }, + { + "id": 149, + "type": "ImageUpscaleWithModel", + "pos": [ + 2240, + -360 + ], + "size": [ + 221.98202514648438, + 46 + ], + "flags": {}, + "order": 47, + "mode": 4, + "inputs": [ + { + "name": "upscale_model", + "type": "UPSCALE_MODEL", + "link": 255 + }, + { + "name": "image", + "type": "IMAGE", + "link": 254 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 298, + 299 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.41", + "Node name for S&R": "ImageUpscaleWithModel", + "widget_ue_connectable": {} + }, + "widgets_values": [] + }, + { + "id": 171, + "type": "StringFunction|pysssss", + "pos": [ + -2120, + -1680 + ], + "size": [ + 230, + 350 + ], + "flags": {}, + "order": 23, + "mode": 4, + "inputs": [ + { + "name": "text_c", + "shape": 7, + "type": "STRING", + "widget": { + "name": "text_c" + }, + "link": 305 + } + ], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 294 + ] + } + ], + "properties": { + "cnr_id": "comfyui-custom-scripts", + "ver": "aac13aa7ce35b07d43633c3bbe654a38c00d74f5", + "Node name for S&R": "StringFunction|pysssss", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "replace", + "yes", + "參考TOPIC的內容將音檔內容依照時間軸,產生繁體中文版本的LRC檔,最多以4秒為單位做分隔,不得大於4秒", + "TOPIC", + "" + ] + }, + { + "id": 169, + "type": "GetImageSize+", + "pos": [ + 1980, + -20 + ], + "size": [ + 159.50155639648438, + 66 + ], + "flags": {}, + "order": 52, + "mode": 4, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 293 + } + ], + "outputs": [ + { + "name": "width", + "type": "INT", + "links": [ + 291 + ] + }, + { + "name": "height", + "type": "INT", + "links": [ + 292 + ] + }, + { + "name": "count", + "type": "INT", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui_essentials", + "ver": "9d9f4bedfc9f0321c19faf71855e228c93bd0dc9", + "Node name for S&R": "GetImageSize+", + "widget_ue_connectable": {} + }, + "widgets_values": [] + }, + { + "id": 167, + "type": "ImageFromBatch", + "pos": [ + -1860, + -1680 + ], + "size": [ + 270, + 82 + ], + "flags": {}, + "order": 50, + "mode": 4, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 298 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 293 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.41", + "Node name for S&R": "ImageFromBatch", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 1, + 1 + ] + }, + { + "id": 133, + "type": "IndexTTSRun", + "pos": [ + -1670, + -1010 + ], + "size": [ + 334.109375, + 338 + ], + "flags": {}, + "order": 19, + "mode": 4, + "inputs": [ + { + "name": "audio", + "type": "AUDIO", + "link": 243 + }, + { + "name": "text", + "type": "STRING", + "link": 244 + }, + { + "name": "dialogue_audio_s2", + "shape": 7, + "type": "AUDIO", + "link": null + } + ], + "outputs": [ + { + "name": "audio", + "type": "AUDIO", + "links": [ + 242, + 245 + ] + } + ], + "properties": { + "cnr_id": "indextts-mw", + "ver": "6f2de5cbacafbbf46793ddbf630940d231894d83", + "Node name for S&R": "IndexTTSRun", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "v1.5", + 30, + 0.8, + 1, + 3, + 1000, + 120, + 4, + true, + false, + true + ] + }, + { + "id": 139, + "type": "TextBox1", + "pos": [ + -2110, + -860 + ], + "size": [ + 400, + 200 + ], + "flags": {}, + "order": 8, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "text1", + "type": "STRING", + "links": [ + 244 + ] + } + ], + "properties": { + "cnr_id": "RES4LYF", + "ver": "7c3fc0aefc865cbf1a89dd9aa3d113fdb97625f4", + "Node name for S&R": "TextBox1", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "這次使用了MultiTalk作為分段音檔產生的標的,並使用KJ版本的Uni3C穩定法,同樣的,因為分段的關係也是有些抖動,但抖動的程度呢,似乎跟開始選擇的圖片有關係,但它對於口型的部分比之前使用的FT表現來得好,不過KJ還在分支中測試,正式版本還沒有出來。\n用我自己做的ListHelper節點,可以自動分段音檔並補上最後一段的空缺,目前這個節點已經可以下載了,他可以用在各種虛擬人模型。" + ] + }, + { + "id": 172, + "type": "ShowText|pysssss", + "pos": [ + -1230, + -1640 + ], + "size": [ + 410, + 430 + ], + "flags": {}, + "order": 35, + "mode": 4, + "inputs": [ + { + "name": "text", + "type": "STRING", + "link": 295 + } + ], + "outputs": [ + { + "name": "STRING", + "shape": 6, + "type": "STRING", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-custom-scripts", + "ver": "aac13aa7ce35b07d43633c3bbe654a38c00d74f5", + "Node name for S&R": "ShowText|pysssss", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "```lrc\n[00:00.671] 幾天呢都在進行聯發科的小型模型的測試。\n[00:04.671] 但同時我覺得聲音也應該經過一下處理。\n[00:08.381] 不然的話呢,有可能影片抖動的原因,\n[00:12.161] 是聲音根本就處理不太好,並不是顯示卡算力不夠的問題。\n[00:16.891] 同時也對字典檔案有了一些小小的了解。\n[00:20.781] 不我發現一個奇怪的問題捏,\n[00:23.691] 當我使用某些特定字數的時候,\n[00:26.791] 文字分段功能似乎完全不會運作。\n[00:30.901] 例如剛剛那段話剛好九十九個字,\n[00:33.681] 那文字長度在這裡就爆炸了。\n[00:35.911] 我本來以為是我刪掉300M模型的問題,\n[00:40.541] 然而根本就不是這樣的。\n[00:42.441] 我懷疑真的是文字切割的異常,\n[00:45.551] 切割不動的話,你語音就會爆炸。\n```" + ] + }, + { + "id": 16, + "type": "WanVideoTextEncode", + "pos": [ + 520, + -630 + ], + "size": [ + 420.30511474609375, + 261.5306701660156 + ], + "flags": {}, + "order": 26, + "mode": 0, + "inputs": [ + { + "name": "t5", + "type": "WANTEXTENCODER", + "link": 15 + }, + { + "name": "model_to_offload", + "shape": 7, + "type": "WANVIDEOMODEL", + "link": 79 + } + ], + "outputs": [ + { + "name": "text_embeds", + "type": "WANVIDEOTEXTEMBEDS", + "slot_index": 0, + "links": [ + 86 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "WanVideoTextEncode", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "A woman is talking.", + "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走", + true + ], + "color": "#332922", + "bgcolor": "#593930" + }, + { + "id": 74, + "type": "ImageResizeKJv2", + "pos": [ + -960, + -730 + ], + "size": [ + 315, + 266 + ], + "flags": {}, + "order": 21, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 238 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 223, + 232, + 233 + ] + }, + { + "name": "width", + "type": "INT", + "links": [ + 109 + ] + }, + { + "name": "height", + "type": "INT", + "links": [ + 110 + ] + } + ], + "properties": { + "cnr_id": "comfyui-kjnodes", + "ver": "c3dc82108a2a86c17094107ead61d63f8c76200e", + "Node name for S&R": "ImageResizeKJv2", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 640, + 360, + "lanczos", + "resize", + "0, 0, 0", + "center", + 16, + "cpu" + ], + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 170, + "type": "GeminiAPI", + "pos": [ + -1540, + -1650 + ], + "size": [ + 270, + 400 + ], + "flags": {}, + "order": 31, + "mode": 4, + "inputs": [ + { + "name": "image", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "name": "video", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "name": "audio", + "shape": 7, + "type": "AUDIO", + "link": 306 + }, + { + "name": "prompt", + "type": "STRING", + "widget": { + "name": "prompt" + }, + "link": 294 + } + ], + "outputs": [ + { + "name": "text", + "type": "STRING", + "links": [ + 290, + 295 + ] + } + ], + "properties": { + "cnr_id": "comfyui-ollamagemini", + "ver": "b508a7581a665b56fe4fd24dad75b96db650228c", + "Node name for S&R": "GeminiAPI", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "What is the meaning of life?", + "audio", + "gemini-2.5-flash-preview-05-20", + false, + false, + "Custom", + "Return only the prompt text itself. No explanations or formatting.", + "raw_text", + "" + ] + }, + { + "id": 129, + "type": "WanVideoLoraSelect", + "pos": [ + 200, + -1040 + ], + "size": [ + 270, + 126 + ], + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "prev_lora", + "shape": 7, + "type": "WANVIDLORA", + "link": null + }, + { + "name": "blocks", + "shape": 7, + "type": "SELECTEDBLOCKS", + "link": null + } + ], + "outputs": [ + { + "name": "lora", + "type": "WANVIDLORA", + "links": [ + 225 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "2da36b7fdaa9da9cf38785116917adf3974387da", + "Node name for S&R": "WanVideoLoraSelect", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "Wan\\Wan21_T2V_14B_lightx2v_cfg_step_distill_lora_rank32.safetensors", + 1.2000000000000002, + false + ] + }, + { + "id": 22, + "type": "WanVideoModelLoader", + "pos": [ + 550, + -1020 + ], + "size": [ + 340, + 280 + ], + "flags": {}, + "order": 20, + "mode": 0, + "inputs": [ + { + "name": "compile_args", + "shape": 7, + "type": "WANCOMPILEARGS", + "link": null + }, + { + "name": "block_swap_args", + "shape": 7, + "type": "BLOCKSWAPARGS", + "link": 96 + }, + { + "name": "lora", + "shape": 7, + "type": "WANVIDLORA", + "link": 225 + }, + { + "name": "vram_management_args", + "shape": 7, + "type": "VRAM_MANAGEMENTARGS", + "link": null + }, + { + "name": "vace_model", + "shape": 7, + "type": "VACEPATH", + "link": null + }, + { + "name": "fantasytalking_model", + "shape": 7, + "type": "FANTASYTALKINGMODEL", + "link": null + }, + { + "name": "multitalk_model", + "shape": 7, + "type": "MULTITALKMODEL", + "link": 265 + } + ], + "outputs": [ + { + "name": "model", + "type": "WANVIDEOMODEL", + "slot_index": 0, + "links": [ + 79, + 85 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "WanVideoModelLoader", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "Wan2_1-I2V-14B-480P_fp8_e4m3fn.safetensors", + "fp16_fast", + "fp8_e4m3fn", + "offload_device", + "sageattn" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 39, + "type": "WanVideoBlockSwap", + "pos": [ + 200, + -870 + ], + "size": [ + 315, + 154 + ], + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "block_swap_args", + "type": "BLOCKSWAPARGS", + "slot_index": 0, + "links": [ + 96 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "d9b1f4d1a5aea91d101ae97a54714a5861af3f50", + "Node name for S&R": "WanVideoBlockSwap", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 35, + false, + false, + true, + 0 + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 69, + "type": "WanVideoSampler", + "pos": [ + 1290, + -1030 + ], + "size": [ + 310, + 650 + ], + "flags": {}, + "order": 38, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "WANVIDEOMODEL", + "link": 85 + }, + { + "name": "image_embeds", + "type": "WANVIDIMAGE_EMBEDS", + "link": 87 + }, + { + "name": "text_embeds", + "shape": 7, + "type": "WANVIDEOTEXTEMBEDS", + "link": 86 + }, + { + "name": "samples", + "shape": 7, + "type": "LATENT", + "link": null + }, + { + "name": "feta_args", + "shape": 7, + "type": "FETAARGS", + "link": null + }, + { + "name": "context_options", + "shape": 7, + "type": "WANVIDCONTEXT", + "link": 304 + }, + { + "name": "cache_args", + "shape": 7, + "type": "CACHEARGS", + "link": null + }, + { + "name": "flowedit_args", + "shape": 7, + "type": "FLOWEDITARGS", + "link": null + }, + { + "name": "slg_args", + "shape": 7, + "type": "SLGARGS", + "link": null + }, + { + "name": "loop_args", + "shape": 7, + "type": "LOOPARGS", + "link": null + }, + { + "name": "experimental_args", + "shape": 7, + "type": "EXPERIMENTALARGS", + "link": null + }, + { + "name": "sigmas", + "shape": 7, + "type": "SIGMAS", + "link": null + }, + { + "name": "unianimate_poses", + "shape": 7, + "type": "UNIANIMATE_POSE", + "link": null + }, + { + "name": "fantasytalking_embeds", + "shape": 7, + "type": "FANTASYTALKING_EMBEDS", + "link": null + }, + { + "name": "uni3c_embeds", + "shape": 7, + "type": "UNI3C_EMBEDS", + "link": 218 + }, + { + "name": "multitalk_embeds", + "shape": 7, + "type": "MULTITALK_EMBEDS", + "link": 309 + }, + { + "name": "teacache_args", + "shape": 7, + "type": "TEACACHEARGS", + "link": null + } + ], + "outputs": [ + { + "name": "samples", + "type": "LATENT", + "links": [ + 90 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "df95c85283d7625fbdf664d0133a2e1c114ba14a", + "Node name for S&R": "WanVideoSampler", + "aux_id": "kijai/ComfyUI-WanVideoWrapper", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 4, + 1.0000000000000002, + 5.000000000000001, + 0, + "fixed", + true, + "unipc", + 0, + 1, + false, + "comfy" + ] + }, + { + "id": 173, + "type": "WanVideoContextOptions", + "pos": [ + 970, + -960 + ], + "size": [ + 270, + 178 + ], + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "vae", + "shape": 7, + "type": "WANVAE", + "link": null + } + ], + "outputs": [ + { + "name": "context_options", + "type": "WANVIDCONTEXT", + "links": [ + 304 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "2da36b7fdaa9da9cf38785116917adf3974387da", + "Node name for S&R": "WanVideoContextOptions", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "uniform_standard", + 81, + 4, + 16, + true, + false + ] + }, + { + "id": 123, + "type": "AudioListGenerator", + "pos": [ + -620, + -870 + ], + "size": [ + 270, + 174 + ], + "flags": {}, + "order": 22, + "mode": 0, + "inputs": [ + { + "name": "waveform", + "type": "AUDIO", + "link": 307 + }, + { + "name": "videofps", + "type": "FLOAT", + "widget": { + "name": "videofps" + }, + "link": 214 + }, + { + "name": "samplefps", + "type": "INT", + "widget": { + "name": "samplefps" + }, + "link": 215 + } + ], + "outputs": [ + { + "name": "cycle", + "type": "INT", + "links": [ + 216, + 236 + ] + }, + { + "name": "audio_list", + "shape": 6, + "type": "AUDIO", + "links": [ + 226 + ] + } + ], + "properties": { + "cnr_id": "Listhelper", + "ver": "e5780332910a2cd51bb49aea56132c87e2ba590a", + "Node name for S&R": "AudioListGenerator", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 23.976, + 81, + true, + 0.1, + "cosine" + ] + }, + { + "id": 175, + "type": "LoadAudio", + "pos": [ + -2010, + -350 + ], + "size": [ + 274.080078125, + 136 + ], + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "AUDIO", + "type": "AUDIO", + "links": [ + 306, + 307, + 308 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.43", + "Node name for S&R": "LoadAudio", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "ComfyUI_00137_.flac", + null, + null + ] + }, + { + "id": 58, + "type": "LoadImage", + "pos": [ + -1460, + -580 + ], + "size": [ + 420, + 350 + ], + "flags": {}, + "order": 13, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 238 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.26", + "Node name for S&R": "LoadImage", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "Studio_00001_.png", + "image" + ], + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 168, + "type": "AddSubtitlesToVideo", + "pos": [ + -1870, + -1560 + ], + "size": [ + 306.08984375, + 362 + ], + "flags": {}, + "order": 53, + "mode": 4, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 299 + }, + { + "name": "json_text", + "shape": 7, + "type": "STRING", + "link": null + }, + { + "name": "subtitle_text", + "shape": 7, + "type": "STRING", + "link": 290 + }, + { + "name": "width", + "type": "INT", + "widget": { + "name": "width" + }, + "link": 291 + }, + { + "name": "height", + "type": "INT", + "widget": { + "name": "height" + }, + "link": 292 + }, + { + "name": "fps", + "type": "FLOAT", + "widget": { + "name": "fps" + }, + "link": 303 + } + ], + "outputs": [ + { + "name": "image", + "type": "IMAGE", + "links": [ + 300 + ] + } + ], + "properties": { + "cnr_id": "audiotools", + "ver": "b05ed6dbc2a2eb19a757d6a6d21b53ebf1558b18", + "Node name for S&R": "AddSubtitlesToVideo", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "类中文字符", + 25, + "C:\\Users\\dseditor\\CUI\\ComfyUI\\custom_nodes\\ComfyUI_AudioTools\\ChironGoRoundTC-600SB.ttf", + 32, + "Black", + "", + -250, + 0, + 1024, + 1024, + 20, + 6 + ] + }, + { + "id": 177, + "type": "DownloadAndLoadWav2VecModel", + "pos": [ + 110, + -120 + ], + "size": [ + 340, + 110 + ], + "flags": {}, + "order": 14, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "wav2vec_model", + "type": "WAV2VECMODEL", + "links": [ + 310 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "ee1250c6bb4292e8c43d98ddbe5e03f93a5fad78", + "Node name for S&R": "DownloadAndLoadWav2VecModel", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "TencentGameMate/chinese-wav2vec2-base", + "fp16", + "offload_device" + ] + }, + { + "id": 117, + "type": "easy float", + "pos": [ + -960, + -1000 + ], + "size": [ + 270, + 58 + ], + "flags": {}, + "order": 15, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "float", + "type": "FLOAT", + "links": [ + 190, + 214, + 303, + 311 + ] + } + ], + "title": "Float(FPS)", + "properties": { + "cnr_id": "comfyui-easy-use", + "ver": "71c7865d2d3c934ccb99f24171e08ae5a81148ac", + "Node name for S&R": "easy float", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 16.000000000000004 + ] + }, + { + "id": 75, + "type": "INTConstant", + "pos": [ + -970, + -870 + ], + "size": [ + 270, + 60 + ], + "flags": {}, + "order": 16, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "value", + "type": "INT", + "links": [ + 111, + 215, + 224, + 312 + ] + } + ], + "title": "SampleFrames", + "properties": { + "cnr_id": "comfyui-kjnodes", + "ver": "c3dc82108a2a86c17094107ead61d63f8c76200e", + "Node name for S&R": "INTConstant", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 81 + ], + "color": "#1b4669", + "bgcolor": "#29699c" + }, + { + "id": 122, + "type": "easy indexAnything", + "pos": [ + 430, + 310 + ], + "size": [ + 270, + 58 + ], + "flags": {}, + "order": 34, + "mode": 0, + "inputs": [ + { + "name": "any", + "type": "*", + "link": 226 + }, + { + "name": "index", + "type": "INT", + "widget": { + "name": "index" + }, + "link": 206 + } + ], + "outputs": [ + { + "name": "out", + "type": "*", + "links": [ + 313 + ] + } + ], + "properties": { + "cnr_id": "comfyui-easy-use", + "ver": "71c7865d2d3c934ccb99f24171e08ae5a81148ac", + "Node name for S&R": "easy indexAnything", + "widget_ue_connectable": { + "index": true + } + }, + "widgets_values": [ + 0 + ] + }, + { + "id": 126, + "type": "WanVideoEncode", + "pos": [ + 900, + -120 + ], + "size": [ + 270, + 242 + ], + "flags": {}, + "order": 32, + "mode": 0, + "inputs": [ + { + "name": "vae", + "type": "WANVAE", + "link": 221 + }, + { + "name": "image", + "type": "IMAGE", + "link": 222 + }, + { + "name": "mask", + "shape": 7, + "type": "MASK", + "link": null + } + ], + "outputs": [ + { + "name": "samples", + "type": "LATENT", + "links": [ + 220 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "2da36b7fdaa9da9cf38785116917adf3974387da", + "Node name for S&R": "WanVideoEncode", + "widget_ue_connectable": {} + }, + "widgets_values": [ + false, + 272, + 272, + 144, + 128, + 0, + 1 + ] + }, + { + "id": 176, + "type": "MultiTalkWav2VecEmbeds", + "pos": [ + 520, + -130 + ], + "size": [ + 291.08203125, + 278 + ], + "flags": {}, + "order": 37, + "mode": 0, + "inputs": [ + { + "name": "wav2vec_model", + "type": "WAV2VECMODEL", + "link": 310 + }, + { + "name": "audio_1", + "type": "AUDIO", + "link": 313 + }, + { + "name": "audio_2", + "shape": 7, + "type": "AUDIO", + "link": null + }, + { + "name": "audio_3", + "shape": 7, + "type": "AUDIO", + "link": null + }, + { + "name": "audio_4", + "shape": 7, + "type": "AUDIO", + "link": null + }, + { + "name": "ref_target_masks", + "shape": 7, + "type": "MASK", + "link": null + }, + { + "name": "num_frames", + "type": "INT", + "widget": { + "name": "num_frames" + }, + "link": 312 + }, + { + "name": "fps", + "type": "FLOAT", + "widget": { + "name": "fps" + }, + "link": 311 + } + ], + "outputs": [ + { + "name": "multitalk_embeds", + "type": "MULTITALK_EMBEDS", + "links": [ + 309 + ] + }, + { + "name": "audio", + "type": "AUDIO", + "links": null + } + ], + "properties": { + "cnr_id": "ComfyUI-WanVideoWrapper", + "ver": "ee1250c6bb4292e8c43d98ddbe5e03f93a5fad78", + "Node name for S&R": "MultiTalkWav2VecEmbeds", + "widget_ue_connectable": {} + }, + "widgets_values": [ + true, + 81, + 25, + 1, + 1, + "para" + ] + }, + { + "id": 148, + "type": "VHS_SelectFilename", + "pos": [ + 1500, + 290 + ], + "size": [ + 219.6669921875, + 58 + ], + "flags": {}, + "order": 44, + "mode": 0, + "inputs": [ + { + "name": "filenames", + "type": "VHS_FILENAMES", + "link": 278 + } + ], + "outputs": [ + { + "name": "Filename", + "type": "STRING", + "links": [ + 253, + 314 + ] + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "a7ce59e381934733bfae03b1be029756d6ce936d", + "Node name for S&R": "VHS_SelectFilename", + "widget_ue_connectable": {} + }, + "widgets_values": { + "index": 2 + } + }, + { + "id": 180, + "type": "DownloadAndLoadGIMMVFIModel", + "pos": [ + 2110, + 500 + ], + "size": [ + 281.9546813964844, + 58 + ], + "flags": {}, + "order": 17, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "gimmvfi_model", + "type": "GIMMVIF_MODEL", + "links": [ + 316 + ] + } + ], + "properties": { + "cnr_id": "ComfyUI-GIMM-VFI", + "ver": "a9735ed9f84533dae45cc6838844d563d3c7d53c", + "Node name for S&R": "DownloadAndLoadGIMMVFIModel", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "gimmvfi_r_arb_lpips_fp32.safetensors" + ] + }, + { + "id": 179, + "type": "GIMMVFI_interpolate", + "pos": [ + 2110, + 280 + ], + "size": [ + 270, + 150 + ], + "flags": {}, + "order": 49, + "mode": 0, + "inputs": [ + { + "name": "gimmvfi_model", + "type": "GIMMVIF_MODEL", + "link": 316 + }, + { + "name": "images", + "type": "IMAGE", + "link": 315 + } + ], + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "links": [ + 317 + ] + }, + { + "name": "flow_tensors", + "type": "IMAGE", + "links": null + } + ], + "properties": { + "cnr_id": "ComfyUI-GIMM-VFI", + "ver": "a9735ed9f84533dae45cc6838844d563d3c7d53c", + "Node name for S&R": "GIMMVFI_interpolate", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 1, + 2, + 831361180443297, + "randomize" + ] + }, + { + "id": 178, + "type": "VHS_LoadVideoPath", + "pos": [ + 1830, + 250 + ], + "size": [ + 231.8896484375, + 286 + ], + "flags": {}, + "order": 46, + "mode": 0, + "inputs": [ + { + "name": "meta_batch", + "shape": 7, + "type": "VHS_BatchManager", + "link": null + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": null + }, + { + "name": "video", + "type": "STRING", + "widget": { + "name": "video" + }, + "link": 314 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 315 + ] + }, + { + "name": "frame_count", + "type": "INT", + "links": null + }, + { + "name": "audio", + "type": "AUDIO", + "links": [ + 318 + ] + }, + { + "name": "video_info", + "type": "VHS_VIDEOINFO", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "a7ce59e381934733bfae03b1be029756d6ce936d", + "Node name for S&R": "VHS_LoadVideoPath", + "widget_ue_connectable": {} + }, + "widgets_values": { + "video": "", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1, + "format": "AnimateDiff", + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "", + "type": "path", + "format": "video/", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1 + } + } + } + }, + { + "id": 181, + "type": "VHS_VideoCombine", + "pos": [ + 2420, + 230 + ], + "size": [ + 260, + 483.3846130371094 + ], + "flags": {}, + "order": 51, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 317 + }, + { + "name": "audio", + "shape": 7, + "type": "AUDIO", + "link": 318 + }, + { + "name": "meta_batch", + "shape": 7, + "type": "VHS_BatchManager", + "link": null + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": null + } + ], + "outputs": [ + { + "name": "Filenames", + "type": "VHS_FILENAMES", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "a7ce59e381934733bfae03b1be029756d6ce936d", + "Node name for S&R": "VHS_VideoCombine", + "widget_ue_connectable": {} + }, + "widgets_values": { + "frame_rate": 32, + "loop_count": 0, + "filename_prefix": "AnimateDiff", + "format": "video/nvenc_hevc-mp4", + "pix_fmt": "yuv420p", + "bitrate": 10, + "megabit": true, + "save_metadata": true, + "pingpong": false, + "save_output": true, + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "AnimateDiff_00001-audio.mp4", + "subfolder": "", + "type": "output", + "format": "video/nvenc_hevc-mp4", + "frame_rate": 32, + "workflow": "AnimateDiff_00001.png", + "fullpath": "C:\\Users\\dseditor\\CUI\\ComfyUI\\output\\AnimateDiff_00001-audio.mp4" + } + } + } + }, + { + "id": 174, + "type": "TextBox1", + "pos": [ + -2670, + -1440 + ], + "size": [ + 400, + 200 + ], + "flags": {}, + "order": 18, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "text1", + "type": "STRING", + "links": [ + 305 + ] + } + ], + "properties": { + "cnr_id": "RES4LYF", + "ver": "7c3fc0aefc865cbf1a89dd9aa3d113fdb97625f4", + "Node name for S&R": "TextBox1", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "這幾天呢都在進行聯發科的小型模型的測試,但同時我覺得聲音也應該經過一下處理,不然的話呢,有可能影片抖動的原因,是聲音根本就處理不太好,並不是顯示卡算力不夠的問題,同時也對字典檔案有了一些小小的了解。\n不過我發現一個奇怪的問題捏,當我使用某些特定字數的時候,文字分段功能似乎完全不會運作,例如剛剛那段話剛好九十九個字,那文字長度在這裡就爆炸了,我本來以為是我刪掉300M模型的問題,然而根本就不是這樣的問題啊,我懷疑真的是文字切割的異常,切割不動的話,語音就會爆炸。" + ] + } + ], + "links": [ + [ + 15, + 11, + 0, + 16, + 0, + "WANTEXTENCODER" + ], + [ + 70, + 59, + 0, + 65, + 0, + "CLIP_VISION" + ], + [ + 79, + 22, + 0, + 16, + 1, + "WANVIDEOMODEL" + ], + [ + 82, + 65, + 0, + 63, + 1, + "WANVIDIMAGE_CLIPEMBEDS" + ], + [ + 85, + 22, + 0, + 69, + 0, + "WANVIDEOMODEL" + ], + [ + 86, + 16, + 0, + 69, + 2, + "WANVIDEOTEXTEMBEDS" + ], + [ + 87, + 63, + 0, + 69, + 1, + "WANVIDIMAGE_EMBEDS" + ], + [ + 90, + 69, + 0, + 28, + 1, + "LATENT" + ], + [ + 96, + 39, + 0, + 22, + 1, + "BLOCKSWAPARGS" + ], + [ + 109, + 74, + 1, + 63, + 8, + "INT" + ], + [ + 110, + 74, + 2, + 63, + 9, + "INT" + ], + [ + 111, + 75, + 0, + 63, + 10, + "INT" + ], + [ + 190, + 117, + 0, + 30, + 4, + "FLOAT" + ], + [ + 199, + 110, + 0, + 121, + 0, + "FLOW_CONTROL" + ], + [ + 206, + 110, + 1, + 122, + 1, + "INT" + ], + [ + 214, + 117, + 0, + 123, + 1, + "FLOAT" + ], + [ + 215, + 75, + 0, + 123, + 2, + "INT" + ], + [ + 216, + 123, + 0, + 110, + 1, + "INT" + ], + [ + 218, + 124, + 0, + 69, + 14, + "UNI3C_EMBEDS" + ], + [ + 219, + 125, + 0, + 124, + 0, + "WANVIDEOCONTROLNET" + ], + [ + 220, + 126, + 0, + 124, + 1, + "LATENT" + ], + [ + 221, + 38, + 0, + 126, + 0, + "WANVAE" + ], + [ + 222, + 128, + 0, + 126, + 1, + "IMAGE" + ], + [ + 223, + 74, + 0, + 128, + 0, + "IMAGE" + ], + [ + 224, + 75, + 0, + 128, + 1, + "INT" + ], + [ + 225, + 129, + 0, + 22, + 2, + "WANVIDLORA" + ], + [ + 226, + 123, + 1, + 122, + 0, + "*" + ], + [ + 227, + 28, + 0, + 121, + 2, + "*" + ], + [ + 228, + 130, + 0, + 121, + 1, + "*" + ], + [ + 229, + 110, + 2, + 130, + 0, + "*" + ], + [ + 230, + 28, + 0, + 130, + 1, + "*" + ], + [ + 231, + 121, + 0, + 30, + 0, + "IMAGE" + ], + [ + 232, + 74, + 0, + 65, + 1, + "IMAGE" + ], + [ + 233, + 74, + 0, + 63, + 2, + "IMAGE" + ], + [ + 234, + 38, + 0, + 63, + 0, + "WANVAE" + ], + [ + 235, + 38, + 0, + 28, + 0, + "WANVAE" + ], + [ + 236, + 123, + 0, + 131, + 0, + "*" + ], + [ + 238, + 58, + 0, + 74, + 0, + "IMAGE" + ], + [ + 242, + 133, + 0, + 137, + 0, + "*" + ], + [ + 243, + 138, + 0, + 133, + 0, + "AUDIO" + ], + [ + 244, + 139, + 0, + 133, + 1, + "STRING" + ], + [ + 245, + 133, + 0, + 140, + 0, + "AUDIO" + ], + [ + 253, + 148, + 0, + 147, + 2, + "STRING" + ], + [ + 254, + 147, + 0, + 149, + 1, + "IMAGE" + ], + [ + 255, + 150, + 0, + 149, + 0, + "UPSCALE_MODEL" + ], + [ + 257, + 147, + 2, + 151, + 1, + "AUDIO" + ], + [ + 262, + 147, + 3, + 153, + 0, + "VHS_VIDEOINFO" + ], + [ + 263, + 153, + 0, + 151, + 4, + "FLOAT" + ], + [ + 264, + 30, + 0, + 154, + 0, + "*" + ], + [ + 265, + 155, + 0, + 22, + 6, + "MULTITALKMODEL" + ], + [ + 278, + 30, + 0, + 148, + 0, + "VHS_FILENAMES" + ], + [ + 290, + 170, + 0, + 168, + 2, + "STRING" + ], + [ + 291, + 169, + 0, + 168, + 3, + "INT" + ], + [ + 292, + 169, + 1, + 168, + 4, + "INT" + ], + [ + 293, + 167, + 0, + 169, + 0, + "IMAGE" + ], + [ + 294, + 171, + 0, + 170, + 3, + "STRING" + ], + [ + 295, + 170, + 0, + 172, + 0, + "STRING" + ], + [ + 298, + 149, + 0, + 167, + 0, + "IMAGE" + ], + [ + 299, + 149, + 0, + 168, + 0, + "IMAGE" + ], + [ + 300, + 168, + 0, + 151, + 0, + "IMAGE" + ], + [ + 303, + 117, + 0, + 168, + 5, + "FLOAT" + ], + [ + 304, + 173, + 0, + 69, + 5, + "WANVIDCONTEXT" + ], + [ + 305, + 174, + 0, + 171, + 0, + "STRING" + ], + [ + 306, + 175, + 0, + 170, + 2, + "AUDIO" + ], + [ + 307, + 175, + 0, + 123, + 0, + "AUDIO" + ], + [ + 308, + 175, + 0, + 30, + 1, + "AUDIO" + ], + [ + 309, + 176, + 0, + 69, + 15, + "MULTITALK_EMBEDS" + ], + [ + 310, + 177, + 0, + 176, + 0, + "WAV2VECMODEL" + ], + [ + 311, + 117, + 0, + 176, + 7, + "FLOAT" + ], + [ + 312, + 75, + 0, + 176, + 6, + "INT" + ], + [ + 313, + 122, + 0, + 176, + 1, + "AUDIO" + ], + [ + 314, + 148, + 0, + 178, + 2, + "STRING" + ], + [ + 315, + 178, + 0, + 179, + 1, + "IMAGE" + ], + [ + 316, + 180, + 0, + 179, + 0, + "GIMMVIF_MODEL" + ], + [ + 317, + 179, + 0, + 181, + 0, + "IMAGE" + ], + [ + 318, + 178, + 2, + 181, + 1, + "AUDIO" + ] + ], + "groups": [ + { + "id": 1, + "title": "LoopPart", + "bounding": [ + 80, + 170, + 1013.08984375, + 355.6000061035156 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 2, + "title": "Uni3CPart", + "bounding": [ + 870, + -340, + 1030, + 490 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 3, + "title": "STEP2:WanPart", + "bounding": [ + 80, + -1130, + 1530, + 775.1306762695312 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 4, + "title": "MultiTalikingPart", + "bounding": [ + 90, + -340, + 745.2000122070312, + 403.6000061035156 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 5, + "title": "STEP1:TTS", + "bounding": [ + -2120, + -1130, + 1140, + 483.6000061035156 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 6, + "title": "STEP2:ImageAndAudioCrop", + "bounding": [ + -980, + -1140, + 1030, + 880 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 8, + "title": "STEP4:UpscaleModel(HighRAM)", + "bounding": [ + 1930, + -460, + 840, + 610 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 9, + "title": "Subtitle", + "bounding": [ + -2130, + -1750, + 1360, + 585.5999755859375 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + } + ], + "config": {}, + "extra": { + "ds": { + "scale": 0.6588450000000011, + "offset": [ + -863.6992783367409, + 525.5511926922801 + ] + }, + "frontendVersion": "1.23.4", + "node_versions": { + "ComfyUI-WanVideoWrapper": "5a2383621a05825d0d0437781afcb8552d9590fd", + "comfy-core": "0.3.26", + "ComfyUI-KJNodes": "a5bd3c86c8ed6b83c55c2d0e7a59515b15a0137f", + "ComfyUI-VideoHelperSuite": "0a75c7958fe320efcb052f1d9f8451fd20c730a8" + }, + "VHS_latentpreview": false, + "VHS_latentpreviewrate": 0, + "VHS_MetadataImage": true, + "VHS_KeepIntermediate": true, + "ue_links": [], + "links_added_by_ue": [] + }, + "version": 0.4 +} \ No newline at end of file diff --git a/nodes.py b/nodes.py index b6ba2f4..a9b3bf0 100644 --- a/nodes.py +++ b/nodes.py @@ -917,177 +917,144 @@ class SaveVideoPath: metadata=saved_metadata ) - return (full_path,) - -class TimestampToLrcNode: + return (full_path,) + +class FrameMatch: """ - ComfyUI節點:將時間戳格式轉換為LRC歌詞格式 + 調整圖像序列到指定幀數的節點 + 如果目標幀數大於輸入幀數,會重複最後一幀來補齊 + 如果目標幀數小於輸入幀數,會截取前面的幀 """ @classmethod def INPUT_TYPES(cls): return { "required": { - "input_text": ("STRING", { - "multiline": True, - "default": "" + "images": ("IMAGE",), # 輸入圖像序列 + "target_frames": ("INT", { + "default": 100, + "min": 1, + "max": 10000, + "step": 1, + "tooltip": "目標幀數" + }), + }, + "optional": { + "fill_mode": (["repeat_last", "loop", "bounce"], { + "default": "repeat_last", + "tooltip": "填充模式:repeat_last=重複最後一幀,loop=循環播放,bounce=來回播放" }), } } - RETURN_TYPES = ("STRING",) - RETURN_NAMES = ("lrc_output",) - FUNCTION = "convert_to_lrc" - CATEGORY = "text/processing" + RETURN_TYPES = ("IMAGE",) + RETURN_NAMES = ("images",) + FUNCTION = "match_frames" + CATEGORY = "ListHelper" - def convert_to_lrc(self, input_text): + def match_frames(self, images, target_frames, fill_mode="repeat_last"): """ - 將時間戳格式轉換為LRC格式 - 輸入格式: >> 0:00-0:04\n>> 文本內容 - 輸出格式: [00:00.00]文本內容 - """ - - lines = input_text.strip().split('\n') - lrc_lines = [] - current_time = None - current_text = "" - - for line in lines: - line = line.strip() - - # 檢查是否為時間戳行 (格式: >> 0:00-0:04) - time_match = re.match(r'^>>\s*(\d+):(\d+)-(\d+):(\d+)$', line) - if time_match: - # 如果之前有累積的文本,先處理它 - if current_time is not None and current_text.strip(): - lrc_lines.append(f"[{current_time}]{current_text.strip()}") - - # 解析開始時間 - start_min = int(time_match.group(1)) - start_sec = int(time_match.group(2)) - current_time = f"{start_min:02d}:{start_sec:02d}.00" - current_text = "" - - # 檢查是否為文本行 (格式: >> 文本內容) - elif line.startswith('>> '): - text_content = line[3:].strip() # 移除 ">> " 前綴 - if text_content: # 只添加非空文本 - if current_text: - current_text += " " + text_content - else: - current_text = text_content - - # 處理空行或其他格式 - elif line == '' or line == '>>': - # 空行保持當前狀態,不做處理 - continue - else: - # 其他格式的行,嘗試作為文本處理 - if line and current_time is not None: - if current_text: - current_text += " " + line - else: - current_text = line - - # 處理最後一段文本 - if current_time is not None and current_text.strip(): - lrc_lines.append(f"[{current_time}]{current_text.strip()}") - - # 合併結果 - lrc_output = '\n'.join(lrc_lines) - - return (lrc_output,) - -try: - import opencc -except ImportError: - print("請安裝opencc庫: pip install opencc-python-reimplemented") - opencc = None - -class ChineseConverterNode: - """ - ComfyUI節點:中文簡繁轉換 - 使用opencc庫進行高質量轉換 - 布林開關控制:True=簡體轉繁體,False=繁體轉簡體 - """ - - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "input_text": ("STRING", { - "multiline": True, - "default": "" - }), - "simp_to_trad": ("BOOLEAN", { - "default": True, - "label_on": "簡體→繁體", - "label_off": "繁體→簡體" - }), - } - } - - RETURN_TYPES = ("STRING",) - RETURN_NAMES = ("converted_text",) - FUNCTION = "convert_chinese" - CATEGORY = "text/processing" - - def __init__(self): - """初始化轉換器""" - if opencc is None: - self.s2t_converter = None - self.t2s_converter = None - print("錯誤:opencc庫未安裝,請執行: pip install opencc-python-reimplemented") - else: - try: - # 簡體轉繁體轉換器 - self.s2t_converter = opencc.OpenCC('s2t.json') - # 繁體轉簡體轉換器 - self.t2s_converter = opencc.OpenCC('t2s.json') - except Exception as e: - print(f"opencc初始化失敗: {e}") - self.s2t_converter = None - self.t2s_converter = None - - def convert_chinese(self, input_text, simp_to_trad): - """ - 轉換中文文本 + 調整圖像序列到目標幀數 Args: - input_text: 輸入文本 - simp_to_trad: True=簡體轉繁體,False=繁體轉簡體 + images: 輸入圖像張量 [N, H, W, C] + target_frames: 目標幀數 + fill_mode: 填充模式 Returns: - 轉換後的文本 + 調整後的圖像序列 """ + import torch - if not input_text.strip(): - return ("",) + if images is None or images.shape[0] == 0: + raise ValueError("輸入圖像序列不能為空") - # 檢查opencc是否可用 - if opencc is None: - error_msg = "錯誤:請先安裝opencc庫\n執行命令: pip install opencc-python-reimplemented" - print(error_msg) - return (error_msg,) + current_frames = images.shape[0] - try: - if simp_to_trad: - # 簡體轉繁體 - if self.s2t_converter is None: - self.s2t_converter = opencc.OpenCC('s2t.json') - converted_text = self.s2t_converter.convert(input_text) + print(f"FrameMatch: 當前幀數 {current_frames} -> 目標幀數 {target_frames}") + + # 如果當前幀數等於目標幀數,直接返回 + if current_frames == target_frames: + return (images,) + + # 如果目標幀數小於當前幀數,截取前面的幀 + elif target_frames < current_frames: + matched_images = images[:target_frames] + print(f"FrameMatch: 截取前 {target_frames} 幀") + + # 如果目標幀數大於當前幀數,需要填充 + else: + additional_frames_needed = target_frames - current_frames + + if fill_mode == "repeat_last": + # 重複最後一幀 + last_frame = images[-1:].clone() # 保持維度 [1, H, W, C] + repeated_frames = last_frame.repeat(additional_frames_needed, 1, 1, 1) + matched_images = torch.cat([images, repeated_frames], dim=0) + print(f"FrameMatch: 重複最後一幀 {additional_frames_needed} 次") + + elif fill_mode == "loop": + # 循環播放整個序列 + loops_needed = (additional_frames_needed + current_frames - 1) // current_frames + looped_images = images.repeat(loops_needed + 1, 1, 1, 1) + matched_images = looped_images[:target_frames] + print(f"FrameMatch: 循環播放 {loops_needed} 次") + + elif fill_mode == "bounce": + # 來回播放(正向 -> 反向 -> 正向...) + additional_images = [] + remaining_frames = additional_frames_needed + forward = True + + while remaining_frames > 0: + if forward: + # 正向播放(跳過第一幀以避免重複) + frames_to_add = min(remaining_frames, current_frames - 1) + if frames_to_add > 0: + additional_images.append(images[1:frames_to_add + 1]) + remaining_frames -= frames_to_add + else: + # 反向播放(跳過最後一幀以避免重複) + frames_to_add = min(remaining_frames, current_frames - 1) + if frames_to_add > 0: + # 反轉順序,並跳過最後一幀 + reversed_frames = torch.flip(images[:-1], dims=[0]) + additional_images.append(reversed_frames[:frames_to_add]) + remaining_frames -= frames_to_add + + forward = not forward + + if additional_images: + bounced_frames = torch.cat(additional_images, dim=0) + matched_images = torch.cat([images, bounced_frames], dim=0) + else: + matched_images = images + + print(f"FrameMatch: 來回播放模式,添加 {additional_frames_needed} 幀") + else: - # 繁體轉簡體 - if self.t2s_converter is None: - self.t2s_converter = opencc.OpenCC('t2s.json') - converted_text = self.t2s_converter.convert(input_text) - - return (converted_text,) - - except Exception as e: - error_msg = f"轉換失敗: {str(e)}" - print(error_msg) - return (error_msg,) + # 預設使用重複最後一幀 + last_frame = images[-1:].clone() + repeated_frames = last_frame.repeat(additional_frames_needed, 1, 1, 1) + matched_images = torch.cat([images, repeated_frames], dim=0) + print(f"FrameMatch: 使用預設模式,重複最後一幀 {additional_frames_needed} 次") + + # 確保輸出幀數正確 + final_frames = matched_images.shape[0] + if final_frames != target_frames: + # 如果還是不匹配,進行最終調整 + if final_frames > target_frames: + matched_images = matched_images[:target_frames] + else: + # 補齊差異 + diff = target_frames - final_frames + last_frame = matched_images[-1:].clone() + extra_frames = last_frame.repeat(diff, 1, 1, 1) + matched_images = torch.cat([matched_images, extra_frames], dim=0) + + print(f"FrameMatch: 完成,最終幀數 {matched_images.shape[0]}") + + return (matched_images,) @@ -1101,8 +1068,7 @@ NODE_CLASS_MAPPINGS = { "CeilDivide": CeilDivide, "LoadVideoPath": LoadVideoPath, "SaveVideoPath": SaveVideoPath, - "TimestampToLrcNode": TimestampToLrcNode, - "ChineseConverterNode": ChineseConverterNode, + "FrameMatch": FrameMatch, } NODE_DISPLAY_NAME_MAPPINGS = { @@ -1115,7 +1081,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "CeilDivide": "CeilDivide", "LoadVideoPath": "LoadVideoPath", "SaveVideoPath": "SaveVideoPath", - "TimestampToLrcNode": "TimestampToLrcNode", - "ChineseConverterNode": "ChineseConverterNode", + "FrameMatch": "FrameMatch", } diff --git a/pyproject.toml b/pyproject.toml index 1ac7d8e..340fd46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "Listhelper" description = "The ListHelper collection is a comprehensive set of custom nodes for ComfyUI that provides powerful list manipulation capabilities. This collection includes audio processing, text splitting, and number generation tools for enhanced workflow automation." -version = "1.0.2" +version = "1.0.3" license = {file = "LICENSE"} dependencies = ["regex"]