Nodes/DIGIT Nodes/DIGIT SRT Tools
ComfyUI Node

DIGIT SRT Tools

Five subtitle-fixing actions in one node — your SRT cleanup drawer

By thedepartmentofexternalservices·Created 7 months ago·Updated 2 months ago· 0
DIGIT SRT Tools
    • output_text
    • output_filepath
    • log
    ◄srt_input►
    ◄actionpost_process►
    ◄srt_filepath►
    ◄save_filepath►
    ◄time_offset_ms0►
    ◄merge_gap_ms500►
    ◄pad_frames0►
    ◄frame_rate23.976►
    ◄snap_to_framesfalse►
    ◄max_chars_per_line42►
    ◄max_lines2►
    ◄remove_hallucinationstrue►
    ◄output_formatsrt►
    ◄languageauto►
    ◄translate_tonone►
    ◄font_nameArial►
    ◄font_size24►
    ◄font_colorwhite►
    ◄outline_colorblack►
    ◄outline_width2►
    ◄shadow_depth1►
    ◄positionbottom_center►
    ◄margin_v30►

    SRT files are text, which means the fixes you need are always the same handful of operations: clean up the timing, convert the format, shift everything, merge the spam, renumber the mess. DIGIT SRT Tools is that handful in a single node. Pick an action, feed it SRT text (or a file path), and it hands you the cleaned result - plus optionally saves it. It's the fix-it companion to SRT Preview (which tells you what's wrong) and the post-processor for anything that came out of SRT Maker or SRT From Video a little rough.

    The actions

    • post_process - the full pipeline: hallucination removal → line-length enforcement → frame padding → snap-to-frame. Same cleanup the transcription nodes run automatically, now available on demand for SRTs from any source.
    • convert_format - SRT to VTT, ASS/SSA, TXT, or all four. ASS output includes full styling (font, color, outline, shadow, position) using the styling inputs.
    • time_offset - shift every timestamp by time_offset_ms (positive = later, negative = earlier). The fix for "the edit changed and now every subtitle is 300ms late." Range is generous: ±600,000 ms.
    • merge - combine adjacent entries whose gap is under merge_gap_ms (default 500ms). Collapses the choppy one-word-per-line garbage into readable blocks.
    • renumber - re-number all entries sequentially from 1, repairing gaps left by manual editing or merging.

    The inputs

    • srt_input / srt_filepath - paste text or give a file path; the file wins if both are set.
    • save_filepath - where to write the output. Leave it empty and you get the result as text only, no file touched - handy for a quick transform in the middle of a graph.
    • time_offset_ms and merge_gap_ms - the two action-specific params above.
    • Then the post-processing inputs (pad_frames, frame_rate, snap_to_frames, max_chars_per_line, max_lines, remove_hallucinations) and the styling inputs (font, color, outline, shadow, position) that convert_format's ASS output uses. Most are ignorable for most actions.

    Outputs: output_text (the processed file), output_filepath (where it saved, if you set one), and log (a summary of what was done).

    How it works and gotchas

    It's pure Python text processing - no API, no credentials, works offline, deterministic. Note it also lists language and translate_to in its inputs; those only apply to the post-processing path that mirrors the transcription nodes, and translation is the one action that does reach out to Gemini, so if you're offline or haven't set up GCP, stick to the text actions.

    One trap worth naming: renumber doesn't re-time anything, it just re-numbers, and merge only merges by gap, not by content - run merge after any timing shifts or the thresholds behave differently than you expect. Install is the same pack as everything else here (ComfyUI Manager, search comfyui-digit, restart), and like SRT Preview, no model files or keys needed for the core actions.

    CategoryDIGIT

    Inputs (23)

    NameTypeDefaultDescription
    srt_inputSTRING—
    actionCOMBOpost_processpost_process: apply line-length, hallucination removal, padding, snap. convert_format: convert to VTT/ASS/TXT. time_offset: shift all timestamps. merge: merge adjacent entries with small gaps. renumber: re-number all entries sequentially.
    srt_filepathoptSTRINGPath to an SRT file. If provided, overrides srt_input text.
    save_filepathoptSTRINGPath to save output. Leave empty to not save (output via text only).
    time_offset_msoptINT0-600000–600000Milliseconds to shift all timestamps (positive = later, negative = earlier). Used with time_offset action.
    merge_gap_msoptINT5000–5000Merge adjacent subtitles with gaps smaller than this (ms). Used with merge action.
    pad_framesoptINT00–120Extend each subtitle by this many frames on both sides (head and tail).
    frame_rateoptFLOAT23.9761–120Frame rate of the video. Used for pad_frames and snap-to-frame.
    snap_to_framesoptBOOLEANfalseSnap all timestamps to nearest frame boundary. Prevents subtitle flicker on frame-accurate systems.
    max_chars_per_lineoptINT420–80Max characters per subtitle line. 42 = Netflix/broadcast standard. 0 = no enforcement.
    max_linesoptINT21–4Max lines per subtitle entry. Entries exceeding this get split.
    remove_hallucinationsoptBOOLEANtrueDetect and remove repeated/hallucinated subtitle entries.
    output_formatoptCOMBOsrtOutput format(s). 'all' saves SRT + VTT + ASS + TXT.
    languageoptCOMBOautoLanguage of the audio. 'auto' lets Gemini detect. Improves accuracy when specified.
    translate_tooptCOMBOnoneTranslate subtitles to this language after transcription. 'none' = no translation.
    font_nameoptSTRINGArialFont family for burn-in subtitles.
    font_sizeoptINT248–120Font size for burn-in subtitles.
    font_coloroptCOMBOwhiteSubtitle text color.
    outline_coloroptCOMBOblackSubtitle outline/border color.
    outline_widthoptINT20–8Outline thickness around subtitle text.
    shadow_depthoptINT10–8Shadow depth behind subtitle text.
    positionoptCOMBObottom_centerWhere to place subtitles on screen.
    margin_voptINT300–200Vertical margin from screen edge (pixels at 1080p).

    Outputs (3)

    NameTypeDescription
    output_textSTRING—
    output_filepathSTRING—
    logSTRING—