ComfyUI Node

Shrug Frame Pair

The start/end frame picker for interpolation loops

By fblissjr·Created about a year ago·Updated 4 months ago· 25
Shrug Frame Pair
  • images
  • start_frame
  • end_frame
  • total_pairs
modesequential_pairs
pair_index0
stride1

Video interpolation needs exactly two frames at a time: a start and an end, with the model filling in everything between. If you've hand-fed those frames into an interpolation workflow before, you know the fiddly part isn't the interpolation - it's selecting which pair out of a long frame batch to use, and doing it repeatably inside a loop. Shrug Frame Pair is the pack's little picker for exactly that: it takes an IMAGE batch, pulls out one (start, end) pair, and also tells you how many pairs exist in total so your loop knows when to stop.

It's a pure graph utility - no server, no ShrugConnection, no network. It just slices tensors. If the rest of the pack is about putting a brain in your graph, this node is about the plumbing around it.

How it works

Your input is a 4D image batch (B, H, W, C) - the output of any video-frame loader. The node computes pairs according to mode:

  • sequential_pairs (default) - each pair is frame i and frame i + stride. Pair 0 is frames 0→1, pair 1 is frames stridestride+1, and so on.
  • first_to_each - every pair starts at frame 0: frame 0→1, frame 0→2, frame 0→3...

pair_index selects which pair you get, and stride (1-32, default 1) skips frames between pair members - useful when consecutive frames are too similar to interpolate meaningfully. Out-of-range indexes don't crash; the node clamps to the nearest valid pair, which is friendlier than it has any right to be.

Three outputs: start_frame and end_frame, each a single-image batch (batch size 1, so they're ready to feed into interpolation nodes that expect one image), and total_pairs - the count you use to drive a loop, so you can iterate pair 0 through pair N-1 and cover the whole clip.

The inputs that matter

  • images (required) - a 4D IMAGE batch.
  • mode - sequential_pairs or first_to_each.
  • pair_index (default 0) - which pair to pull.
  • stride (default 1) - frame distance between pair members.

How to install

Standard pack install. ComfyUI Manager → search Shrug-Prompter → Install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/fblissjr/shrug-prompter

Dependencies are already present in any modern ComfyUI (httpx, orjson, pillow, torch, numpy), and this node adds nothing beyond them. It works standalone, without the heylookitsanllm server.

Common issues

  • "expected (B,H,W,C) image batch" error. You fed it something that isn't a 4D tensor - a single image (3D) or a list. Wrap it into a batch first.
  • Interpolation looks wrong for late pairs. If your video has very similar consecutive frames, stride is your friend; pair frames farther apart. That's the one tuning knob this node gives you, and it's the one people skip.
  • Loop never ends. Make sure your loop's iteration count uses total_pairs, not the raw frame count. The two are different once stride is involved.
Categoryshrug

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
modeCOMBOsequential_pairs2 options: sequential_pairs, first_to_each
pair_indexINT0
strideINT11–32

Outputs (3)

NameTypeDescription
start_frameIMAGE
end_frameIMAGE
total_pairsINT