3.2 متقدم: التحكم في توليد الفيديو
تعلّم كيفية التحكم في فيديو باستخدام تقدير الوضعية وWan Animate.
داخل سير العمل
معاينة للقراءة فقط للقالب المصدر. افتحه في Cloud لاستكشاف العُقد وإجراء التغييرات.
Loading the graph
Open full-size workflow previewالملفات في سير العمل هذا
- المخرج
- فيديو
- المؤلف
- ComfyUI
استدعِ هذا النموذج من التعليمة البرمجية الخاصة بك
يستخدم الطلب أدناه المخطط والإعدادات المُعدّة نفسها كما في Playground. يمكن لكل إرسال أن يبدأ تشغيلًا مدفوعًا؛ لا تُعِد تلقائيًا محاولة إرسال لا تُعرف نتيجته.
What you need
- Runs on
- Comfy Cloud
- المفتاح
- COMFY_API_KEY
- ملفاتك
- تُرفع بواسطة التعليمة البرمجية من عناوين URL الخاصة بها
يتطلب خطة Cloud مدفوعة ورصيدًا.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"411": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"451:481",
0
],
"vae": [
"451:413",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"414": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"421",
1
],
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": [
"421",
2
],
"images": [
"411",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"415": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/ComfyUI",
"format": "auto",
"format.codec": "auto",
"video": [
"414",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"420": {
"class_type": "LoadVideo",
"inputs": {
"file": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Load Video"
}
},
"421": {
"class_type": "GetVideoComponents",
"inputs": {
"video": [
"420",
0
]
},
"_meta": {
"title": "Get Video Components"
}
},
"422": {
"class_type": "DWPreprocessor",
"inputs": {
"bbox_detector": "yolox_l.onnx",
"detect_body": "enable",
"detect_face": "enable",
"detect_hand": "enable",
"image": [
"421",
0
],
"pose_estimator": "dw-ll_ucoco_384_bs5.torchscript.pt",
"resolution": 512,
"scale_stick_for_xinsr_cn": "disable"
},
"_meta": {
"title": "DWPose Estimator"
}
},
"470": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"421",
1
],
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": [
"421",
2
],
"images": [
"422",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"479": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Reference Image"
}
},
"451:399": {
"class_type": "WanAnimateToVideo",
"inputs": {
"batch_size": 1,
"clip_vision_output": [
"451:431",
0
],
"continue_motion_max_frames": 1,
"height": 720,
"length": 73,
"negative": [
"451:409",
0
],
"pose_video": [
"422",
0
],
"positive": [
"451:407",
0
],
"reference_image": [
"479",
0
],
"vae": [
"451:413",
0
],
"video_frame_offset": 0,
"width": 1280
},
"_meta": {
"title": "WanAnimateToVideo"
}
},
"451:400": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"451:399",
2
],
"model": [
"451:403",
0
],
"negative": [
"451:399",
1
],
"positive": [
"451:399",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 166084212342096,
"steps": 6
},
"_meta": {
"title": "KSampler"
}
},
"451:403": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "lightx2v_I2V_14B_480p_cfg_step_distill_rank128_bf16.safetensors",
"model": [
"451:444",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"451:407": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"451:412",
0
],
"text": "The porcelain-headed automaton in a charcoal wool vest, cream shirt, tailored trousers and black dress shoes dances alone in a vast brutalist concrete plaza at midnight. Its brass neck joints and bone-white head catch an amber rim light through drifting sea fog and light drizzle. It steps side to side, rolls its shoulders, spins and drops into a low crouch before springing up with its arms flung wide, its movements smooth yet slightly mechanical. Puddles on the wet slate-grey concrete mirror every move. Moody indigo and graphite tones, cinematic lighting, detailed fabric and porcelain textures, steady camera."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"451:409": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"451:412",
0
],
"text": "static, blurry details, subtitles, style, artwork, painting, image, still, overall grayish tone, worst quality, low quality, JPEG compression artifacts, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn face, deformed, disfigured, malformed limbs, fused fingers, frozen frame, cluttered background, three legs, too many people in the background, walking backward."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"451:412": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "wan"
},
"_meta": {
"title": "Load CLIP"
}
},
"451:413": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "Wan2_1_VAE_fp32.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"451:431": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"451:445",
0
],
"crop": "center",
"image": [
"421",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"451:444": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "Wan2_2-Animate-14B_fp8_e4m3fn_scaled_KJ.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"451:445": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "clip_vision_h.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"451:481": {
"class_type": "TrimVideoLatent",
"inputs": {
"samples": [
"451:400",
0
],
"trim_amount": [
"451:399",
3
]
},
"_meta": {
"title": "Trim Video Latent"
}
}
})
workflow.set_input("479", "image", client.assets.from_url("https://comfy.org/catalog-media/8a6af52a-f7ae-43fa-8811-b3aeb947cfaa/406a017b-96fc-4e71-a475-e04f9d953853"))
workflow.set_input("420", "file", client.assets.from_url("https://comfy.org/catalog-media/339f3f4a-c95c-41c1-afd6-b55cffed9192/a84db708-e387-4541-9aa6-56ea830532c3"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("415"):
output.to_file(output.name)جرّب مثالًا
حول سير العمل هذا
سير العمل المتقدم هذا في ComfyUI مصمم لتمكين المستخدمين من التحكم في توليد الفيديو باستخدام تقنيات تقدير الوضعية ونموذج Wan Animate. في جوهره، يستفيد سير العمل من DWPose Estimator لاستخراج معلومات الوضعية من فيديو إدخال، وإنشاء “فيديو تحكم” يعمل كمخطط لتوليد محتوى فيديو جديد. ثم يُستخدم فيديو التحكم هذا بالتزامن مع نموذج Wan Animate لإنتاج فيديوهات تتبع الوضعيات والحركات الملتقطة في اللقطات الأصلية. يتضمن سير العمل عدة عقد أساسية، منها VAEDecode لفك ترميز التمثيلات الكامنة، وCreateVideo لتجميع الإطارات في فيديو، وSaveVideo لإخراج النتيجة النهائية. بالإضافة إلى ذلك، تُستخدم العقدة المخصصة comfyui_controlnet_aux لتعزيز التحكم في عملية توليد الفيديو، لضمان أن يتوافق الإخراج بشكل أقرب مع رؤية المستخدم. هذا سير العمل مفيد للرسامين المتحركين ومنشئي المحتوى الذين يريدون إنتاج فيديوهات بحركة وأسلوب متسقين، موجّهين بمراجع وضعية محددة.
الأسئلة والأجوبة
يقوم DWPose Estimator باستخراج معلومات الوضعية من فيديو الإدخال، مُنشئًا فيديو تحكم يوجّه عملية التحريك في توليد محتوى جديد.
نعم، يمكنك رفع أي فيديو كمرجع للوضعية، لكن لأفضل النتائج تأكد أن الفيديو يُظهر بوضوح الحركات التي تريد تكرارها.
يستخدم Wan Animate فيديو التحكم للوضعية والصور المرجعية لتوليد فيديوهات جديدة تلتزم بالوضعيات والأساليب المحددة.
اختر بعناية الصور المرجعية وفيديوهات الوضعية، واضبط معلمات سير العمل حسب الحاجة لضبط الإخراج وفق الأسلوب والحركة المطلوبين.