Nodes/FM_nodes/StabStitch
ComfyUI Node

StabStitch

Stitch two videos into one steady panorama with StabStitch

By FuouM·Created 2 years ago·Updated about a year ago· 9
StabStitch
  • video_1
  • video_2
  • combined
  • stab
  • mask
interpolate_modeFAST
do_linear_blendfalse

Ever shot two overlapping videos of the same scene - two phones, or a panned sequence - and wished you had one wide, steady clip instead? That's stitching, and StabStitch is a research model for unsupervised online video stitching (Nie et al., 2024) wrapped into a single ComfyUI node. Give it two overlapping videos and it warps them onto a shared surface, blends the overlap, and stabilizes the result so the seam doesn't shimmy. It's not a "stitch two static photos into a panorama" tool - it's a full video-panorama node, which is rare enough that it's basically the only game in town in ComfyUI.

How it works

StabStitch runs three learned sub-networks in sequence: a spatial warp that aligns each frame pair onto a common target mesh, a temporal warp that smooths motion across time, and a smooth warp that blends the meshes so the combined video doesn't jerk. The output is a combined, stabilized video plus the warped second input and a blend mask. All three models run on the GPU and the whole thing processes frame-by-frame.

Important quirk baked into the design: both inputs get resized to 360x480 internally. That's the model's working resolution, and it's the single most common source of surprise with this node - feed it your 1080p clips and it will silently downscale them. That's why the author recommends running the StabStitch Crop Resize node first (see below).

The inputs that matter

  • video_1 and video_2 - the two overlapping clips, as IMAGE batches.
  • interpolate_mode - FAST (default) uses PyTorch's grid_sample, which is quick but can leave a thin black border where frames meet. NORMAL uses a slower custom interpolation that avoids the black boundary. The author's guidance: use NORMAL (or flip do_linear_blend on) to kill dark borders.
  • do_linear_blend - boolean, default off. Turning it on linear-blends the overlapping region, which also helps eliminate dark borders. The bundled workflow uses FAST + do_linear_blend=True.

Three outputs: combined (the stitched, stabilized video), stab (the warped second video), and mask (the blend mask as an IMAGE).

Installing it

FM_nodes via ComfyUI Manager (search FM_nodes) or:

cd ComfyUI/custom_nodes
git clone https://github.com/FuouM/FM_nodes

then restart. Requirements are just torch and einops. Models: all three .pth files from the StabStitch pre-trained model section - temporal_warp.pth, spatial_warp.pth, smooth_warp.pth - go into custom_nodes/FM_nodes/models/stabstitch/. Miss any one and the node errors on queue, so check all three are present.

Where people get burned

The 360x480 downscale is the trap - either pre-crop with the Crop Resize node or accept the resolution hit and upscale after. Also, stitch quality is heavily dependent on the overlap: the model assumes the two videos actually share a visible region, so two unrelated clips will produce garbage, and it doesn't handle wildly different exposure between the two cameras gracefully - fix exposure before stitching. And it's a per-frame pipeline, so a long clip through all three networks takes real time. Expect research-demo quality, not Hollywood steadicam: great for fixing a shaky two-camera shoot, less so for production-grade panoramas.

CategoryFM_nodes/StabStitch

Inputs (4)

NameTypeDefaultDescription
video_1IMAGE
video_2IMAGE
interpolate_modeCOMBOFAST2 options: FAST, NORMAL
do_linear_blendBOOLEANfalse

Outputs (3)

NameTypeDescription
combinedIMAGE
stabIMAGE
maskIMAGE