Nodes/Difforum/Difforum · Datamosh (optical flow)
ComfyUI Node

Difforum · Datamosh (optical flow)

Optical-flow motion melt — the video-art look without touching the codec

By chillithebillis·Created 3 months ago·Updated about a month ago· 7
Difforum · Datamosh (optical flow)
  • frames
  • frames
intensity0.70
modegrid
block_size16
flow_scale0.50

Real datamoshing comes from corrupting an MPEG stream so the motion vectors keep flowing while the frame refresh melts away - a beloved glitch-aesthetic, but it's fiddly, format-dependent, and easy to turn into a corrupted file. Difforum · Datamosh (optical flow) reproduces that look on a plain IMAGE batch with no codec involved: it computes optical flow between frames, then uses the motion vectors to keep moving pixels flowing while the detail "refresh" degrades in blocks. Same visual grammar - the signature stretchy, liquid smearing - minus the file corruption.

The mechanism is a flow-based melting, and the controls shape the flavor of the melt:

  • intensity (default 0.7, 0–1) - overall melt strength. This is the main "how destroyed is it" dial.
  • mode - grid, melt, or edge. Grid is the macroblock datamosh (chunky square blocks smearing - the classic MPEG look). Melt is the smooth, liquid smear. Edge emphasizes smearing along detected edges, which keeps objects more recognizable while they dissolve.
  • block_size (default 16, 4–64) - the macroblock size for grid mode. Smaller blocks = finer, more "digital" breakup; larger = chunkier, more violent melt. 16 mimics old codec macroblocks.
  • flow_scale (default 0.5, 0.25–1) - how much the optical flow is amplified when driving the smear. Lower = subtler drift, higher = the melt drags further behind the motion.

Output: frames (IMAGE batch), same length in/out. It slots anywhere footage flows - after the Feedback Sampler, on a Load Video → effects path, or on a single clip you're glitching up for a VJ set.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/chillithebillis/Difforum.git difforum

Restart ComfyUI ([Difforum] loaded N nodes) or ComfyUI Manager → "Difforum". numpy-only, and like Flow Stabilize the optical flow is the pack's own lightweight code - no model downloads.

Common issues

  • Everything turns to mush at once. intensity too high and block_size too large compound fast - you get a brown smear instead of a datamosh. Drop intensity to 0.4–0.5 and dial block size down first.
  • No visible effect on still footage. Datamosh needs motion - it's literally driven by the optical flow between frames. A static clip has no vectors to smear, so nothing happens. Feed it footage with actual movement.
  • The look is too "codec-y" vs. too "liquid." That's grid vs. melt. If grid reads as broken video and melt reads as weird blur, edge is the middle ground that keeps structure readable.

It's the more aggressive cousin of the pack's Glitch node - Glitch is DSP databending (kernels, bitcrush, VHS), Datamosh is pure motion melt. If you're building glitchy VJ material, you'll want both, but this one gives you the specific 2000s-video-art energy that real datamosh fans chase, with zero risk to your source file.

CategoryDifforum/effects

Inputs (5)

NameTypeDefaultDescription
framesIMAGE
intensityFLOAT0.700–1
modeCOMBOgrid3 options: grid, melt, edge
block_sizeINT164–64
flow_scaleFLOAT0.500.25–1

Outputs (1)

NameTypeDescription
framesIMAGE