Nodes/ComfyUI-DragAnything/DragAnythingRunRandom
ComfyUI Node

DragAnythingRunRandom

No trajectory? Let DragAnything take your subject on a random walk

By chaojie·Created 2 years ago·Updated 2 years ago· 72
DragAnythingRunRandom
  • image
  • mask_list
  • image
svd_pathstable-video-diffusion-img2vid
draganything_pathDragAnything
sd_pathchilloutmix
width576
height320
frame_number20
num_inference_steps25
motion_bucket_id180
controlnet_cond_scale1.00
decode_chunk_size8
move_speed5
move_border20

The core DragAnything workflow needs you to hand over a trajectory_list - a JSON path of per-frame coordinates. Drawing that by hand is fiddly, and if you're just trying to see whether the pack works at all, it's a wall of setup before your first result. DragAnythingRunRandom skips the trajectory entirely: you give it a mask, and it invents the motion for you.

This node is the same all-in-one generator as DragAnythingRun (loads SVD, the DragAnything ControlNet, and the chilloutmix DIFT extractor itself), except it builds the trajectory out of thin air. Here's the mechanism: for each mask, it finds the mask's centroid, then for every frame it nudges that point by a random amount in each axis. The resulting random-walk path is fed through the exact same pipeline - DIFT identity embedding, per-frame Gaussian heatmaps, ControlNet-guided SVD - as if you'd typed it in. Every queue gives you a different motion, which is the point.

The inputs that matter

Same core as the manual node - image, mask_list (one mask per entity), frame_number, width/height (multiples of 64), num_inference_steps, motion_bucket_id, controlnet_cond_scale, decode_chunk_size - plus the two knobs that replace trajectory_list:

  • move_speed (5) - the max pixel jitter per frame, in either axis. Small = slow, gentle drifting; large = wild, frantic motion.
  • move_border (20) - keeps the centroid from wandering within 20px of the image edges. Raise it if subjects keep bumping into the frame sides.

There is no trajectory input here, and you can't predict where it'll go - that's the trade for zero setup. The random path is always generated to be frame_number long, so the README's "trajectory must be at least as long as frame_number" rule is satisfied for you automatically. Output is an IMAGE batch of frame_number frames → VHS_VideoCombine to save.

Installing

Same pack as the rest: ComfyUI Manager → "ComfyUI-DragAnything", or git clone https://github.com/chaojie/ComfyUI-DragAnything into custom_nodes/, then pip install -r requirements.txt (or at least pip install diffusers==0.19.3 - that version pin is non-negotiable here). Models go in the pack's hardcoded pretrained_models/ folder:

cd custom_nodes/ComfyUI-DragAnything/pretrained_models
git-lfs clone https://huggingface.co/windwhinny/chilloutmix.git
git-lfs clone https://huggingface.co/weijiawu/DragAnything
git-lfs clone https://huggingface.co/stabilityai/stable-video-diffusion-img2vid

Troubleshooting

  • "Missing Node Types" after install → the pack's bundled SaveText/LoadText nodes are colliding with another pack (the standard offender is ComfyUI-nodes-hnmr). Clear the conflict, restart ComfyUI fully.
  • Motion never stays on the subject → since there's no real trajectory, a high move_speed will visibly wander; drop it to 2–3 and keep controlnet_cond_scale at 1.0.
  • Slow runs are expected - the pipeline uses CPU offload, so keep frame_number low while experimenting.
  • The diffusers==0.19.3 pin can break unrelated custom nodes after install; that's the first thing to check if the pack works but others don't.

Use this node to prove the pack runs and to brainstorm what motion looks good; once you find a direction you like, grab the real thing - swap to DragAnythingRun and hand it the actual path.

CategoryDragAnything

Inputs (14)

NameTypeDefaultDescription
svd_pathCOMBOstable-video-diffusion-img2vid1 options: pretrained_models.txt
draganything_pathCOMBODragAnything1 options: pretrained_models.txt
sd_pathCOMBOchilloutmix1 options: pretrained_models.txt
imageIMAGE
widthINT576
heightINT320
frame_numberINT20
mask_listIMAGE
num_inference_stepsINT25
motion_bucket_idINT180
controlnet_cond_scaleFLOAT1.00
decode_chunk_sizeINT8
move_speedINT5
move_borderINT20

Outputs (1)

NameTypeDescription
imageIMAGE