Nodes/Craftgear Nodes/Camera Shake
ComfyUI Node

Camera Shake

Camera Shake

By craftgear·Created 8 months ago·Updated 6 months ago· 1
Camera Shake
  • images
  • images
strength1.00
edge_mode

One thing that instantly reads as "AI video" is a camera that's too steady - tripod-locked, sterile, weightless. Camera Shake is the fix: it applies a handheld-style shake to an image batch, combining rotation and movement with per-frame smoothness so it looks like someone was actually holding the camera. Slap it after a video model or a frame sequence and before the final encode, and the footage gains a little of that lived-in wobble.

How it works

The mechanism is honest and simple. For each frame in the batch it generates a smooth random-walk series for horizontal shift, vertical shift, and rotation - each one is exponentially smoothed noise, so the motion is continuous and organic instead of jittery per-frame. Those values get baked into an affine transform matrix per frame, and every frame is warped with bilinear sampling. It works on the whole batch at once, so you drop an IMAGE in and get an IMAGE out, frame count preserved.

The one design decision you actually have to make is what happens at the edges - shaking a frame reveals the border. That's what edge_mode controls:

  • 1_scale - scales the image up first so the shake never exposes a gap. You lose a little border zoom, but nothing gets cut.
  • 2_crop - warps, then crops and resizes back to the original dimensions. Keeps output size, trims the edges.
  • 3_prepad - pads the image with replicated edge pixels first, shakes, then crops back to the original frame. This is the cleanest of the three and the one I'd reach for by default: no scaling distortion, full frame preserved.

Landscape and portrait frames get different shake profiles (landscape favors rotation, portrait favors vertical drift), which is a small touch that keeps the result from looking canned.

Inputs and outputs that matter

Only three inputs, and only one of them needs thinking about:

  • images - the batch to shake.
  • strength - 0.0 to 3.0, default 1.0. Low values are subtle handheld wobble; anything above ~1.5 starts looking like a fight scene. At 0 it returns the images untouched.
  • edge_mode - the dropdown above.

Output: images, same batch size, ready to feed VAE decode or a video encoder.

Install

Search craftgear in ComfyUI Manager and install a numbered version (the README notes that nightly fails on security restrictions), or:

cd ComfyUI/custom_nodes
git clone https://github.com/craftgear/comfyui-craftgear-nodes

Restart ComfyUI. Pure PyTorch tensor ops, no model downloads, no extra pip packages.

Where people get burned

  • Where did my edges go? If you use 2_crop or 3_prepad, the output is a crop of the shaken frame - you lose border pixels by design. If you can't afford to lose anything, 1_scale is the mode for you, at the cost of a slight scale-up.
  • It won't fix temporal coherence on its own. The shake is per-frame and smooth, but if the source frames already flicker, adding shake won't hide it - clean up the source first.
  • Don't crank strength for "just a bit of life." Handheld subtlety lives in the 0.2–0.8 range. Start there.
Categorycraftgear/image

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
strengthFLOAT1.000–3
edge_modeCOMBO3 options: 1_scale, 2_crop, 3_prepad

Outputs (1)

NameTypeDescription
imagesIMAGE