Nodes/VideoX-Fun/Video To Canny
ComfyUI Node

Video To Canny

Turn a clip into edge maps for Wan-Fun's control models

By aigc-apps·Created 2 years ago·Updated 24 days ago· 2,174
Video To Canny
  • input_video
  • images
low_threshold100
high_threshold200
video_length81

VideoToCanny does exactly what it says: it runs Canny edge detection over every frame of a video and hands you back an edge-map version of the clip. On its own that's not very exciting - the point is what it feeds. Wire its output into a Wan-Fun Control model's control-video input and you've got structural conditioning: the new video follows the edges of the old one while everything else (style, subject, lighting) is free to change.

Why Canny, specifically

Canny is the classic edge detector in the ControlNet world - a two-threshold algorithm that produces clean, thin edge lines rather than the softer gradients you get from something like Softedge. It's the sharpest, most literal of the structure-conditioning options: great for architecture, mechanical objects, and anything with hard, well-defined contours. It's also the least forgiving - because the edges are so precise, a Canny map locks in more of the original shape than something softer like Depth, which is worth keeping in mind if the thing you're regenerating needs to change silhouette (a fitted top becoming a flowing dress, say). For that kind of change, VideoToDepth's looser spatial conditioning tends to cooperate better.

The fields

  • input_video - your source clip, fed in as an IMAGE batch (the standard way ComfyUI represents a video: a stack of frames, not a special video type). Load it with whatever video-loading node you're already using upstream.
  • low_threshold (default 100) and high_threshold (default 200) - the classic Canny hysteresis thresholds, 0-255. Pixels above the high threshold are always counted as edges; pixels below the low threshold never are; anything in between only counts if it connects to a strong edge. Raise both to get fewer, more confident edges (good for noisy or busy footage); lower both to pick up finer detail at the cost of more visual clutter in the map.
  • video_length (default 81, max 81, step 4) - how many frames get processed. That step-of-4 isn't arbitrary: Wan's VAE compresses time by roughly 4x, so frame counts across this whole pack are quantized to the same 4n+1 pattern (81, 121, 161...) the samplers expect. Match this to the frame count you're feeding your Control sampler, or you'll end up with a control video shorter or longer than the generation it's meant to guide.

The single output, images, is your edge-map video as an IMAGE batch - plug it straight into the control_video input on WanFunV2VSampler (paired with a Wan-Fun-Control checkpoint) to actually use it.

Installing VideoX-Fun

ComfyUI Manager: search "VideoX-Fun" (or its older name, "CogVideoX-Fun"). Manual: cd ComfyUI/custom_nodes && git clone https://github.com/aigc-apps/VideoX-Fun, restart.

You don't need any extra model downloads for this specific node - Canny detection is a classical CV algorithm, no weights involved. What you do need is a Wan-Fun-Control checkpoint downloaded and placed under ComfyUI/models/Fun_Models/ if you actually want to use the output for anything (this node alone just produces edge maps; the generation happens in the sampler downstream).

Common issues

The output is a plain IMAGE batch, not a video file - if you're expecting an mp4 to drop out of this node, it won't; you'll need a video-combine node downstream to preview or save it, same as with any other frame-batch output in ComfyUI.

Mismatched frame counts are the other trap: if video_length here doesn't match the length your sampler is generating, the control conditioning either runs out partway through or gets truncated, and the tail of your video loses guidance. And because Canny is the strictest of the structure-conditioning methods, if your output looks like it's fighting the prompt - refusing to change proportions, outlines bleeding through where they shouldn't - that's usually the Canny map being too literal for what you're asking the model to do, not a bug. Loosen the thresholds, switch to VideoToDepth, or lower the control weight on the Control model if the workflow exposes one.

CategoryCogVideoXFUNWrapper

Inputs (4)

NameTypeDefaultDescription
input_videoIMAGE
low_thresholdINT1000–255
high_thresholdINT2000–255
video_lengthINT811–81

Outputs (1)

NameTypeDescription
imagesIMAGE