Nodes/Comfyui-MOSS-Transcribe-Diarize-T8/MOSS 字幕样式 · T8star-Aix
ComfyUI Node

MOSS 字幕样式 · T8star-Aix

ASS styling without hand-editing a Style line

By T8mars·Created 25 days ago·Updated about 21 hours ago· 5
MOSS 字幕样式 · T8star-Aix
    • MOSS 字幕样式
    • 样式 JSON
    font_nameNoto Sans CJK SC
    font_size0
    alignment2
    margin_v56
    speaker_colorstrue
    primary_color&H00FFFFFF
    outline_color&H00000000
    back_color&H64000000
    outline3
    shadow1
    video_width1920
    video_height1080

    If you've ever hand-edited an ASS subtitle file, you know the joy of a Style: line with fifteen colon-separated fields where one typo silently breaks every subtitle. T8_MOSS_SubtitleStyle is the node that builds that line for you. It's part of the MOSS Transcribe Diarize pack's export pipeline: it centralizes resolution, font, layout, outline, shadow, and per-speaker coloring into a single typed object you can reuse across as many T8_MOSS_SubtitleExport nodes as you like. Change the style once, every exporter picks it up.

    There's not a lot of magic here - and that's the point. It's a clean configuration surface on top of a format that otherwise reads like a 1990s config file. You set it up once, and it feeds the ASS exporter.

    The inputs that matter

    • video_width / video_height - your output resolution, 1920×1080 by default. The ASS script resolution lives here, so set it to match your video or the subtitle text will scale wrong.
    • font_size - 0 means auto, derived from resolution. Set a fixed number if you want it locked. Auto is genuinely fine for most work.
    • font_name - Noto Sans CJK SC by default, which is a solid choice for mixed CJK/Latin text. If you're rendering on a machine that doesn't have it installed, the player will fall back to something and it may look off - check your font availability.
    • alignment - ASS alignment, 1–9 (the numpad layout: 2 is bottom-center, the default and the one you'll almost always want).
    • margin_v - vertical margin in pixels (default 56).
    • speaker_colors - on by default; each speaker gets a distinct color so you can tell voices apart at a glance. This is the feature that makes diarization visible in the output.
    • primary_color / outline_color / back_color - ASS &H colors. And here's the trap: ASS uses BGR order, not RGB. &H00FFFFFF is white (it reads as 00 alpha + BBGGRR), &H00000000 is black, &H64000000 is semi-transparent black. If your colors come out swapped, you're pasting RGB hex into a BGR field.
    • outline (default 3) and shadow (default 1) - stroke and shadow width. If your subtitles disappear against white video, bump the outline.

    Outputs: the MOSS 字幕样式 object (wire it into T8_MOSS_SubtitleExport) and a 样式 JSON dump if you want to inspect or share the exact values.

    Installing it

    Same pack, same steps:

    cd ComfyUI/custom_nodes
    git clone https://github.com/T8mars/Comfyui-MOSS-Transcribe-Diarize-T8.git comfyui-MOSS-Transcribe-Diarize-T8
    cd comfyui-MOSS-Transcribe-Diarize-T8
    pip install -r requirements.txt
    python scripts/check_transformers.py      # requires Transformers >= 5.5.0
    python scripts/download_models.py --comfyui-root ..\..
    

    Restart ComfyUI and it's there with the other eight nodes. Note it does not require the model - it's pure styling, so it works even if the model download failed.

    Gotchas

    • BGR colors, every time. The &H fields are ASS-native BGR. Swapped-looking colors are almost always this. There's no RGB→BGR conversion on the way in, which is correct for ASS but easy to forget.
    • Resolution drives font auto-sizing. If you set font_size to auto (0) and your video_width/height don't match the actual video, the scale will be subtly off. Set resolution first, then decide whether auto-size is right.
    • It's a config object, not an exporter. It produces no subtitles itself. If you wire it to a preview expecting SRT output, you'll get style JSON instead - that's the wrong node for that job. Pair it with T8_MOSS_SubtitleExport.
    • Structure validation is real. The pack validates style fields (no stray commas or newlines that would corrupt the ASS Style line), so a bad value errors at the node instead of corrupting the file downstream.
    CategoryT8star-Aix/Audio/MOSS Transcribe Diarize

    Inputs (12)

    NameTypeDefaultDescription
    font_nameSTRINGNoto Sans CJK SC
    font_sizeINT00–512
    alignmentINT21–9
    margin_vINT560–2160
    speaker_colorsBOOLEANtrue
    primary_colorSTRING&H00FFFFFF
    outline_colorSTRING&H00000000
    back_colorSTRING&H64000000
    outlineINT30–20
    shadowINT10–20
    video_widthINT192016–16384
    video_heightINT108016–16384

    Outputs (2)

    NameTypeDescription
    MOSS 字幕样式T8_MOSS_SUBTITLE_STYLE
    样式 JSONSTRING