ComfyUI Node

SRTLyricsMerger

Attach real durations to your lyric segments so prompts know their time budget

By vrgamegirl19·Created about a year ago·Updated 2 days ago· 717
SRTLyricsMerger
    • merged_json
    srt_text
    lyrics_json

    In the VRGameDevGirl music-video pipeline, scenes aren't generated one at a time by hand - the workflow generates scene prompts from lyrics, and each lyric segment needs to know how long its scene is supposed to run so the video model produces the right frame count. That's this node's whole job: it takes an SRT (the one BeatSceneDurationNode writes) and a lyrics JSON, and merges each lyric segment with the duration of its matching scene.

    The output is the same JSON you put in, but every key that looks like lyricSegmentN becomes lyricSegmentN_Duration_X.XXXs. Downstream, the prompt creator reads that suffix and knows segment 12 gets a 4.120s scene while segment 3 gets 6.875s - which is how the "every scene fits its song timing" trick actually works.

    How it works

    The merge is a cross-reference, not a magic alignment. It parses the SRT for its SCENE n cue lines (the exact format BeatSceneDurationNode emits - that's the contract between the two nodes), converts each scene's start/end to seconds, and computes durations. Then for every key in the lyrics JSON matching lyricSegment(\d+), it looks up the segment number, finds the matching scene's duration, and rewrites the key with the duration appended. Segments without a matching scene get UNKNOWN rather than a crash, which is a polite touch for a loosely-coupled pipeline.

    Two things keep this honest. First, it's string parsing with a strict regex - the SRT has to actually contain SCENE n cue lines, not just raw timestamped text. If you feed it an SRT from somewhere else, you get no matches and a JSON full of _UNKNOWN keys. Second, the merge is keyed on the segment number, not on any semantic alignment - so it assumes your lyrics JSON and SRT were built from the same segmentation pass.

    Inputs and outputs

    Just two inputs, both multiline strings: srt_text and lyrics_json. One output: merged_json, a pretty-printed JSON string. Wire srt_text from BeatSceneDurationNode (or anything that produces its format), lyrics_json from your lyric-transcription step, and feed merged_json into the prompt/storyboard stage.

    Install and gotchas

    Install the pack via ComfyUI Manager (search "vrgamedev") or cd ComfyUI/custom_nodes && git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl, then restart. No model downloads - this is pure text manipulation, no audio processing, so it's one of the lightest nodes in the pack.

    The gotchas are all format discipline. If your SRT lacks the SCENE n lines, the output is silently full of UNKNOWN durations - check the SRT's cue format before debugging downstream. And the lyrics JSON needs the lyricSegmentN key convention; if your transcription node names segments differently, you'll see every key pass through unchanged and wonder why. It's a glue node, and like all good glue it's very specific about what it'll stick to.

    CategoryText

    Inputs (2)

    NameTypeDefaultDescription
    srt_textSTRING
    lyrics_jsonSTRING

    Outputs (1)

    NameTypeDescription
    merged_jsonSTRING