Nodes/ComfyUI-MiniMaxH3-Contex-Loop/MiniMax H3 Frame Index Switch
ComfyUI Node

MiniMax H3 Frame Index Switch

Alternate end-frame targets per scene for A/B endpoint chains

By ethanfel·Created 17 days ago·Updated about 20 hours ago· 315
MiniMax H3 Frame Index Switch
  • frame_1
  • frame_2
  • frame_3
  • frame_4
  • frame_5
  • frame_6
  • frame_7
  • frame_8
  • image
  • selected_index
  • status
clip_index1

MiniMax H3 Frame Index Switch is a tiny utility, and it deserves a short article for that reason: it's the missing glue for FL2VA chains where each scene should aim at a different endpoint image. It takes the current scene index and one or more target images, picks the right one for this scene, and hands it to the Frame Gate. That's the whole job, and it does it with a wrapping quirk worth knowing.

Why it exists

In a first-to-last chain you often want to alternate endpoints - the classic example from the tooltips is an A→B→A chain: scene 1 animates from the opening frame A toward target B, scene 2 heads back toward A, scene 3 toward B again. ComfyUI's stock index switch doesn't wrap, and it doesn't know about scene indices inside a recursive loop. This node is purpose-built: clip_index from Current Shot selects frame_1 for scene 1, frame_2 for scene 2, and then wraps - scene 3 goes back to frame_1. Connected targets are selected in order and wrap whenever the index exceeds their count, so a two-target chain alternates forever.

The inputs and outputs

Inputs: clip_index (one-based scene number, default 1), frame_1 (required - always the scene-1 target), and optional frame_2 through frame_8. Outputs: image (the selected target for the current scene), selected_index (which slot won after wrapping), and status (a STRING reporting the scene, the selected target and how many targets are connected).

For the A→B→A example, connect frame B to frame_1 and opening frame A to frame_2 - that way scene 1 (odd) aims at B and scene 2 (even) aims back at A, and the wrap keeps the pattern going.

Where it plugs in

The image output connects to Frame Gate's last_frame input, which forwards it to the stock H3 I2V node's last_frame on every loop. You're not expected to use this node standalone - it's one step in the FL2VA wiring, and honestly if you're doing a simple I2V chain you don't need it at all. It earns its keep the moment your plan alternates or cycles endpoints.

Installing it

Part of ComfyUI-MiniMaxH3-Contex-Loop (ComfyUI Manager: search "MiniMax H3 Contex Loop"), or:

cd ComfyUI/custom_nodes && git clone https://github.com/ethanfel/ComfyUI-MiniMaxH3-Contex-Loop.git

Restart ComfyUI. No extra dependencies beyond the pack; H3 weights and a current ComfyUI with native Add Guide (PR #15439) are the standing requirements.

Common issues

The wrapping catches everyone once: with only frame_1 connected, every scene gets frame_1 - a two-target chain needs both frame_1 and frame_2 connected, or the alternation silently doesn't happen. And remember it selects by scene index, not by frame count: a scene that takes three retries still uses the same target slot, which is what you want. If the wrong target shows up, verify clip_index is actually the recursive scene counter from Current Shot and not a stale constant.

Categoryconditioning/minimax/contex_loop

Inputs (9)

NameTypeDefaultDescription
clip_indexINT11–128One-based scene index from H3 Chain Current Shot. Scene 1 selects frame_1, scene 2 selects frame_2, then selection wraps.
frame_1IMAGELast-frame target selected for scene 1. For an A to B to A chain, connect frame B here and the opening frame A to frame_2.
frame_2optIMAGEOptional last-frame target 2. Connected targets are selected in order and wrap when clip_index exceeds their count.
frame_3optIMAGEOptional last-frame target 3. Connected targets are selected in order and wrap when clip_index exceeds their count.
frame_4optIMAGEOptional last-frame target 4. Connected targets are selected in order and wrap when clip_index exceeds their count.
frame_5optIMAGEOptional last-frame target 5. Connected targets are selected in order and wrap when clip_index exceeds their count.
frame_6optIMAGEOptional last-frame target 6. Connected targets are selected in order and wrap when clip_index exceeds their count.
frame_7optIMAGEOptional last-frame target 7. Connected targets are selected in order and wrap when clip_index exceeds their count.
frame_8optIMAGEOptional last-frame target 8. Connected targets are selected in order and wrap when clip_index exceeds their count.

Outputs (3)

NameTypeDescription
imageIMAGESelected image for the current scene. Connect this to Frame Gate's last_frame input.
selected_indexINTOne-based target slot selected after wrapping.
statusSTRINGReports the scene index, selected target, and connected target count.