DJZ Datamosh
Block-Shift Motion Glitching
- images
- IMAGE
DJZ Datamosh is the founding node of the pack's datamosh dynasty - the family that runs V1 through V8, each generation taking a different swing at glitch art. This one is the "motion glide" approach: it looks at how blocks of pixels move between consecutive frames and deliberately smears them, producing that dragged, liquid-melt motion you associate with broken video compression. It needs at least two frames to do anything, so it's strictly a batch/video tool.
If you've ever seen a video where moving content leaves smeared trails and the frame looks like it's sagging - that's the look. This node makes it happen in the graph instead of at a codec level. It's the same family of effect as the later datamosh nodes, but this one is pure tensor math in torch: no ffmpeg, no external tools, no codecs. That's its quiet superpower.
How it works
The algorithm is block motion estimation with a glitch twist. It divides consecutive frames into blocks of block_size pixels, then for each block searches the previous frame for the closest matching block within a shift window. But instead of using those shifts to do clean motion compensation, it copies the previous frame's blocks into the current frame at the shifted positions. Each frame becomes a recomposite of the frame before it - and over a sequence, that accumulation is where the melting comes from. The search uses a shift_range step size; the tooltip is candid that higher values are faster but less accurate.
The inputs that matter
images- a batch of at least 2 frames. Fewer than 2 and the node passes the input through untouched.block_size(4–64, default 16) - block granularity. Small blocks = fine-grained smearing; large blocks = chunky distortion.max_shift(1–32, default 8) - how far blocks can wander. Bigger = more extreme drag.shift_range(1–4, default 2) - the search step. Higher = faster, less accurate. Start at 2.
Output is an IMAGE batch, same frame count.
Installing it
DJZ Datamosh is part of DJZ-Nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt
Restart ComfyUI, or install via Manager (search "DJZ-Nodes"). Pure torch/numpy - no codecs, no models, no external binaries. This is the rare datamosh node that just works after install.
Common issues
The performance reality: the shift search is brute-force over every block and every candidate shift, and on CPU it gets slow quickly. Keep max_shift and block_size moderate (16/8 are fine) and don't throw 4K batches at it. Second, the effect builds across frames, so the first frame is always clean and distortion accumulates - if the whole thing looks untouched, your batch is too short or too static (nothing moves, so shifts are near zero). Feed it footage with real motion and it starts doing its thing.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| block_size | INT | 164–64 | — |
| max_shift | INT | 81–32 | — |
| shift_range | INT | 21–4 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |