Nodes/mircudx custom nodes/CC Script Chunk Planner
ComfyUI Node

CC Script Chunk Planner

Splitting a voiceover into Kling-sized chunks, without an LLM

By mircudx·Created 6 months ago·Updated 6 months ago· 0
CC Script Chunk Planner
    • segments_json
    • segments_text
    • total_estimated_seconds
    • segment_count
    script_text
    max_seconds_per_chunk10.0
    speech_rate_wpm140
    respect_sentence_boundariestrue

    Kling clips are short - roughly 10 seconds of usable video per generation. So a 40-second voiceover can't be one prompt; it has to become four. CC Script Chunk Planner is the node that figures out where to cut. It's pure word-count math, no LLM, no API, no tokens spent. Paste your script in and it hands back a timed, segment-by-segment breakdown.

    How it works

    It estimates how long it takes to speak your script and splits it accordingly. The model is simple: count words, divide by speech rate. With the defaults - max_seconds_per_chunk of 10 and speech_rate_wpm of 140 - a chunk can hold about 23 words (10 seconds × 140 wpm ÷ 60). Your 150-word script becomes roughly six chunks.

    The respect_sentence_boundaries toggle is the quality control. On by default, it tries to cut between sentences so each segment is a complete thought - much easier for the LLM and Kling to work with. If a single sentence is still too long, it splits on clauses, then on raw word counts as a last resort. Turn it off and it chunks on a strict word budget, which gives cleaner timing but can slice mid-sentence.

    Each segment comes out with a segment_index, the text, a word count, and an estimated speaking time. The total_estimated_seconds output is the whole script's runtime - handy for a quick sanity check against what you're trying to make.

    Inputs and outputs that matter

    • script_text - your voiceover. Nothing else here is worth fiddling with on a first pass; 10 seconds and 140 wpm are sensible defaults.

    • segments_json - the structured list. This is the one to wire: feed it into CC Kling Request Builder's prepared_segments_json so the LLM plans exactly these chunks instead of re-chunking on its own.

    • segments_text - the same breakdown as readable lines, for a Preview node.

    • segment_count - drives the segment gates and the frame planner downstream. This number is the backbone of the whole auto-skip workflow.

    • total_estimated_seconds - total runtime, as a float.

    Why it exists when the LLM could do it

    The request builder will happily chunk a script itself if you skip this node - the pack's workflows are designed to work either way. But there's a good reason to do it here first, deterministically, before any tokens are spent: it makes segment_count predictable. The auto-skip gates decide which Kling nodes run based on that number, and you want to know it before you pay for an LLM call, not after. It also gives you a human-readable preview of exactly what each video segment will show, which beats discovering the model's segment 3 is a random word fragment.

    One practical note: the estimate is words-per-minute, and real pacing varies. A dense script with long pauses runs longer than the math says. If your renders keep coming up short against the planned duration, nudge speech_rate_wpm down (or max_seconds_per_chunk up) rather than fighting individual segments.

    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. 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 (4)

    NameTypeDefaultDescription
    script_textSTRING
    max_seconds_per_chunkFLOAT10.03–30
    speech_rate_wpmINT14080–220
    respect_sentence_boundariesBOOLEANtrue

    Outputs (4)

    NameTypeDescription
    segments_jsonSTRING
    segments_textSTRING
    total_estimated_secondsFLOAT
    segment_countINT