Nodes/ComfyUI-ASSSSA/Subtitle extraction
ComfyUI Node

Subtitle extraction

Get the subtitle track out of that MKV without touching a terminal

By HighDoping·Created about a year ago·Updated about a year ago· 1
Subtitle extraction
    • output_path
    video_pathvideo.mp4
    stream0

    Every fan-subbed MKV you've ever downloaded is sitting on a subtitle track it's not telling you about. SubtitleExtraction is the node that pulls it out: point it at a video, and it finds the soft subtitle stream and extracts it into a standalone file in ComfyUI's output/ folder. No ffmpeg one-liner, no terminal. That's the whole pitch, and for a one-input job it does exactly that.

    It's the natural front half of this pack's pipeline: SubtitleExtraction → ASSSubtitleReader → edit/translate → ASSSubtitleSave → SubtitleEmbedding. Want to re-subtitled a video you got from somewhere? This is where you start.

    How it works

    Give it video_path and a stream index (default 0). The node first runs ffprobe to enumerate the subtitle streams in the file, then ffmpeg -map 0:s:<stream> extracts the one you asked for. It figures out the file extension from the stream's codec, and hands you the output_path (STRING) where the file landed.

    A couple of things to know before you use it:

    • The stream index counts subtitle streams, starting at 0. stream=0 is the first subtitle track in the file, 1 the second, and so on - it's a position in the list of subtitle streams, not the raw stream ID you'd see in ffprobe. If you ask for a stream that doesn't exist, expect an error.
    • The extension is whatever the codec is called, and that's a trap. SRT-encoded streams extract with the codec name subrip, so you'll get moviename.subrip - a file most players won't auto-detect. Rename it to .srt and it behaves normally. ASS streams extract as .ass, which is fine, and other codecs give you their own names.
    • It only works when the file actually has a soft subtitle track. That's mostly MKVs (and some MP4s carrying mov_text). An AVI with burned-in subs has nothing to extract, and the node will tell you no subtitle streams were found.
    • Like the rest of this pack, video_path is a typed string, not a file picker - absolute path or a path relative to where ComfyUI runs.

    One more honest note: the node returns output_path even when extraction fails, so don't trust the return value blindly - glance at the console log to confirm it actually succeeded before you feed the path downstream.

    Installing

    It's part of ComfyUI-ASSSSA. Install the pack from ComfyUI Manager (search "ComfyUI-ASSSSA") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/HighDoping/ComfyUI_ASSSSA
    

    Restart ComfyUI. No Python packages and no models to download - the only requirement is FFmpeg and FFprobe on your PATH (ffprobe ships with every normal ffmpeg install), since this node drives both.

    CategoryComfyUI_ASSSSA

    Inputs (2)

    NameTypeDefaultDescription
    video_pathSTRINGvideo.mp4
    streamINT00–100Subtitle stream index to extract (0 for first stream)

    Outputs (1)

    NameTypeDescription
    output_pathSTRING