Nodes/ComfyUI-Subtitle-Effects/Subtitle Source (字幕输入源)
ComfyUI Node

Subtitle Source (字幕输入源)

Feed it an SRT, a CSV, or a sticky note — it always spits out the same subtitle data

By liaowu-boos·Created 3 months ago·Updated 3 months ago· 2
Subtitle Source (字幕输入源)
    • subtitle_data
    • preview
    formatauto
    fps30.00
    text
    srt_path
    total_duration0.0
    duration_per_line3.0

    Every subtitle workflow in ComfyUI has the same boring first step: getting your words into something a renderer can use. If you've poked around the subreddit, you know the well-trodden path is transcription - WhisperSRT and friends turn speech into an .srt - and then everybody shrugs about what to do with that file. SubtitleSource is the part that connects the two. It's the input node for the ComfyUI-Subtitle-Effects pack, and its whole job is to take subtitles in whatever shape they're in and hand back a single structured SUBTITLE_DATA that every animated-subtitle node in the pack understands.

    It's a plumbing node in the best sense - one input, five formats, one output - and once you've met it you'll use it in every workflow the pack touches.

    What it actually does

    The node parses subtitles and packs them into a custom SUBTITLE_DATA type: a list of entries (each with a start, an end, and text) plus the fps you gave it, so downstream nodes know which frame a subtitle belongs to. That's the whole trick. Because the effect nodes accept the same type, you can parse once and wire the result into several renderers, or shove a SubtitleTextReplace node in the middle and edit before anything touches pixels.

    It auto-detects five formats, so usually you don't even have to think:

    • SRT - the standard 1\n00:00:01,000 --> 00:00:03,000\nText block format
    • Bracket timeline - (0.0, 1.5) First line, handy for quick manual entry
    • JSON - [{"start": 0.0, "end": 1.5, "text": "..."}]
    • CSV - start,end,text columns
    • Plain text - one line per subtitle, timed for you automatically

    The format dropdown defaults to auto and sniffs which one you pasted. If you set it to auto and point it at a file, it'll read the file and detect from the contents.

    The inputs that matter

    You've got three required inputs: format, fps, and text. Set fps to match your frame sequence - it drives the frame math for every entry, and mismatches are the classic way subtitles drift.

    Two optional inputs earn their keep:

    • srt_path - a path to a subtitle file. If it's set and the file exists, it wins over the text box. Handy when you're batch-processing folders or your subtitles came from Whisper.
    • duration_per_line - for plain text with no timestamps: each line gets this many seconds (default 3). There's also total_duration; if you set it, the lines are evenly spread across the whole clip instead.

    The two outputs are subtitle_data (the SUBTITLE_DATA you wire into effect nodes) and preview - a plain-text bracket-format rendering of what got parsed, which you can feed into a text display node to eyeball without rendering.

    Install

    It ships as part of one pack with all the other subtitle nodes, so there's nothing special here:

    cd ComfyUI/custom_nodes
    git clone https://github.com/liaowu-boos/ComfyUI-Subtitle-Effects.git
    cd ComfyUI-Subtitle-Effects
    pip install "Pillow>=9.0.0" "jieba>=0.42"
    

    Or use ComfyUI Manager and search for liaowu-boos/ComfyUI-Subtitle-Effects. Restart ComfyUI and you'll find everything under the Subtitle Effects category. The renderer runs on CPU via Pillow - zero VRAM - and no model files are downloaded for this node. hanlp>=2.1 is in the manifest but only the podcast scroller needs it, and it degrades gracefully if missing.

    Common issues

    • File isn't reading. The node tries utf-8, utf-8-sig, gbk, and gb2312 in turn, so Chinese-language SRTs saved in GBK usually just work. If your file still comes back empty, make sure the path is absolute and the file actually exists - a typo'd path silently falls back to the text box.
    • Subtitles appear at the wrong time. Almost always an fps mismatch between this node and your renderer. Keep them in sync.
    • Blank preview. Means nothing parsed - check format if you're pasting something exotic, and remember srt_path overrides text entirely when both are set.

    One honest note: this pack is young and small, so don't expect a crowd of prebuilt workflows to copy. The upside is the pieces are simple enough that the pipeline above is the whole tutorial.

    CategorySubtitle Effects/Input

    Inputs (6)

    NameTypeDefaultDescription
    formatCOMBOauto6 options: auto, srt, bracket, json, csv, plain
    fpsFLOAT30.001–120
    textSTRING
    srt_pathoptSTRING
    total_durationoptFLOAT0.00–36000
    duration_per_lineoptFLOAT3.00.5–30

    Outputs (2)

    NameTypeDescription
    subtitle_dataSUBTITLE_DATA
    previewSTRING