Nodes/ComfyUI-SA-Nodes-QQ/Wan Video Flowmap Distortion (QQ)
ComfyUI Node

Wan Video Flowmap Distortion (QQ)

Give your video camera shake, water, and heat shimmer with a flowmap

By siraxe·Created 11 months ago·Updated 2 days ago· 72
Wan Video Flowmap Distortion (QQ)
  • video
  • flowmap
  • distorted_video
distortion_strength1.0
edge_mode

Wan is great at inventing motion, but it's terrible at predictable motion - precise camera shake, a fixed wobble, a heat-shimmer you can tune. That's not what a diffusion model does. WanVideoFlowmapDistortion is the alternative: instead of prompting for distortion, you give it a displacement map and it physically warps every frame. Same idea as a displacement map in After Effects or a normal-map shader in a game - one reusable map, applied consistently to a whole clip.

It's from siraxe/ComfyUI-WanVideoWrapper_QQ, the "(QQ)" Wan experiment pack. Think of this node as the compositing glue: after Wan hands you a clean base clip, you distort it deterministically rather than re-rolling the generation.

How it works

The mechanism is displacement mapping via PyTorch's grid_sample. Each frame is treated as a texture, and the flowmap tells it how much to shift at every pixel. The map is a standard RGB image where the channels encode the displacement:

  • R channel = horizontal (X) displacement
  • G channel = vertical (Y) displacement
  • B channel = magnitude

Values are stored in the 0–1 range with 0.5 meaning "no motion," and distortion_strength scales how far a displacement actually moves pixels. The node auto-resizes the flowmap to match your video (bilinear upscale) and, if the frame counts differ, repeats the last map frame or trims - so a single still map can drive an entire clip.

edge_mode controls what happens at the borders when pixels get pushed off-canvas: border clamps and stretches the edge pixels, reflection mirrors the image (nicer for subtle effects), zeros fills with black. For a gentle shake, reflection looks far cleaner than the others; zeros is for when you want a visible frame edge.

Inputs and outputs that matter

  • video - your IMAGE tensor, frames first: [B, H, W, C].
  • flowmap - the displacement map described above.
  • distortion_strength - 0 to 10, default 1. This is your main creative dial; 0.2 is a subtle wobble, 3+ is full psychedelic warp.
  • edge_mode - border, reflection, or zeros.

Output is a single distorted_video IMAGE, same shape as the input, so it feeds straight back into your compositing chain or a video saver.

Installation

cd ComfyUI/custom_nodes
git clone https://github.com/siraxe/ComfyUI-WanVideoWrapper_QQ.git

Then restart ComfyUI (or install via ComfyUI Manager by searching "WanVideoWrapper_QQ"). The pack has no real requirements.txt; this node only needs torch, which you already have. If you previously had the wanwrapper_qq folder from before the pack's v1.3.4 rename to ComfyUI-SA-Nodes-QQ, remove the old folder so the two don't collide on import.

Common issues

Most problems here are flowmap authoring mistakes, not node bugs. A map stored with displacement around 0.5-mid will do nothing until you push distortion_strength - that's expected, not a failure. And a flowmap that came out of an optical-flow pass is usually in a different encoding (raw motion vectors) than what this node expects, so if a "cool optical flow map" produces garbage, re-encode it to the R=u / G=v / B=magnitude convention first. It's GPU-bound through grid_sample, so a 14B-resolution clip at 81 frames will move fast, but give it a proper VRAM headroom just like any video op.

CategoryWanVideoWrapper_QQ/video

Inputs (4)

NameTypeDefaultDescription
videoIMAGE
flowmapIMAGE
distortion_strengthFLOAT1.00–10
edge_modeCOMBO3 options: border, reflection, zeros

Outputs (1)

NameTypeDescription
distorted_videoIMAGE