Alignment to String (对齐数据转字符串)
Turn a whisper_alignment wire into JSON you can actually read
- alignment
- alignment_string
ComfyUI has this recurring pattern where a custom node defines its own data type - in this case whisper_alignment, the timestamped subtitle segments that the video-overlay nodes consume - and then everything else in your graph can't see inside it. Alignment2StringNode is the keyhole that fixes that. You feed it a whisper_alignment wire and it hands you back the same data as a readable JSON string, which you can then inspect in a text box, save to disk, or pass to any node that only speaks plain strings.
It's a conversion node, not a transcription node. It does zero speech-to-text work itself - it just serializes whatever alignment data arrives on its input.
How it works
The implementation is refreshingly honest about its job: if the input is a list, it runs json.dumps(..., indent=2, ensure_ascii=False) and returns the pretty-printed string. If the input is already a string, it passes it through untouched. If the input is None, it returns "[]" rather than crashing your graph. That's the whole mechanism - which is exactly what you want from a utility node.
The ensure_ascii=False matters if you're working with non-Latin scripts: Chinese text in the segments stays readable instead of coming out as \uXXXX escapes.
Inputs, outputs, and the round-trip
One required input, alignment (type whisper_alignment), and one output, alignment_string (a STRING). Wire it after whatever emits the alignment data - typically a Whisper transcription node whose segments include value, start, and end fields - and read the output in a ShowText-style node to actually see what your transcript looks like.
Where it shines is pairing with its sibling String2AlignmentNode. That node parses a JSON string back into whisper_alignment, so the two form a lossless round-trip: alignment → string → edit the JSON by hand (fix a timestamp, trim a line) → back to alignment. If you want to tweak subtitle timing before it hits VideoOverlayWithSubtitlesNode, this pair is the workflow.
Installing it
Same install as the rest of the pack - it ships in GuardSkill/ComfyUI-VideoOverlayFFmpeg. ComfyUI Manager, search "ComfyUI-VideoOverlayFFmpeg", or:
cd ComfyUI/custom_nodes
git clone https://github.com/GuardSkill/ComfyUI-VideoOverlayFFmpeg
cd ComfyUI-VideoOverlayFFmpeg
pip install -r requirement.txt
Then restart ComfyUI. Like the other nodes in the pack, the real runtime dependency is a system ffmpeg on your PATH; there are no model downloads. If the input is malformed or empty you get a harmless "[]" rather than an error, which is forgiving but means you should double-check the wire before you trust the output.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| alignment | whisper_alignment | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| alignment_string | STRING | — |