Nodes/mircudx custom nodes/CC Frame Pair Planner
ComfyUI Node

CC Frame Pair Planner

The frame-pairing calculator that keeps your Kling segments straight

By mircudx·Created 6 months ago·Updated 6 months ago· 0
CC Frame Pair Planner
    • pairs_json
    • pairs_text
    • required_frame_count
    segment_count1
    available_frame_count0
    start_frame_index1

    This node is a calculator, not a generator. It calls no API, needs no key, runs nothing on a GPU - it answers one annoying bookkeeping question: which start and end frame does each of my Kling segments need? If you're building a multi-segment Kling image-to-video chain out of the Auto-Card-Generator pack, this is the node that keeps segment 3 from quietly grabbing the wrong frames.

    How it works

    You tell it three numbers and it plans the pairing math for you. segment_count is how many Kling segments your script turned into. available_frame_count is how many keyframes you actually loaded (the LoadImage nodes feeding the chain). start_frame_index is where your keyframes begin - 1 if the first frame is the first image, something else if you trimmed the start.

    For every segment it assigns start_frame_index to the first, then walks up: segment 1 gets frame N, segment 2 gets frame N+1, and so on. Each segment's end_frame is simply the next frame - unless that frame doesn't exist, in which case it comes back empty. That's the pack's stated rule: "if the next image does not exist, last frame stays empty." Segment 1 gets a proper start→end pair, later segments run start-frame-only, which is exactly how the bundled workflows chain Kling clips together.

    Two details worth knowing. required_frame_count is simply start_frame_index + segment_count - the number of frames a full start/end chain needs. And the node assumes 10-second segments: the seconds_window in its JSON is hardcoded to i*10 → (i+1)*10, so if you're running 5-second or 20-second clips the window numbers are just informational.

    The inputs and outputs that matter

    You'll set all three INTs, and honestly available_frame_count is the one to be careful with. Leave it at 0 and the node assumes you have every frame it needs. Give it a real number and it flags where you run out - end frames start coming back null and end_frame_missing flips to true. That's the feature: it tells you before you render that your storyboard is one keyframe short.

    • pairs_json - the structured plan (segment → start frame → end frame). Nothing consumes it directly; it's your record of what the chain is doing.
    • pairs_text - the same plan as readable lines, handy to drop into a Preview or text node.
    • required_frame_count - wire this anywhere you need to know how many images to load.

    Where it sits

    In the reference workflow it's at the end of the graph, fed by segment_count from the Kling plan parser. It's a verification and planning node rather than something Kling itself reads - the frames actually flow through the segment gates and into the KlingStartEndFrameNode API nodes (which live in a separate Kling pack, not this one).

    Troubleshooting

    The failure mode is self-inflicted: set segment_count higher than your available_frame_count and every later segment ends up with an empty end frame. That's not a bug - it's the node telling you your keyframes don't cover the script. Either load more frames or trim the script. And since nothing here touches the network, the node cannot fail on credentials, proxies, or a dead API. It just does math.

    Installing it

    This node ships in the Auto-Card-Generator pack by mircudx - a small MIT-licensed bundle of script-to-Kling pipeline nodes with zero pip dependencies and no model downloads (the LLM and video generation both run through APIs you bring keys for). Two ways in: ComfyUI Manager → Install Custom Nodes → search "Auto-Card-Generator", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mircudx/Auto-Card-Generator
    

    Restart ComfyUI and it shows up under "Card Creator/LLM". If you import one of the bundled workflows and get missing-node errors, use the *_local_safe_compat.json variant - it's trimmed for bare local installs. The reference workflows also expect a separate Kling custom-node pack (KlingStartEndFrameNode) to be installed; this pack provides the planning logic around it, not the Kling API calls themselves.

    CategoryCard Creator/LLM

    Inputs (3)

    NameTypeDefaultDescription
    segment_countINT11–64
    available_frame_countINT00–128
    start_frame_indexINT11–128

    Outputs (3)

    NameTypeDescription
    pairs_jsonSTRING
    pairs_textSTRING
    required_frame_countINT