Nodes/FxAi(凤希全能节点)/凤希AI - 视频分段器V1
ComfyUI Node

凤希AI - 视频分段器V1

Cut a long video into segments your VRAM can survive

By fxai666·Created 7 months ago·Updated about 20 hours ago· 47
凤希AI - 视频分段器V1
    • 视频路径
    • 分段时长列表
    • 分段总数
    • 帧率
    • 分段信息
    • 音频
    • 起始帧
    • 原始宽度
    • 原始高度
    ◄视频文件►
    ◄关键帧JSON[]►
    ◄跳过初始段false►
    ◄包含尾部段true►
    ◄是否平均分段true►
    ◄平均分段时长10.00►
    ◄目标模型标准►

    The setup this node exists for

    You have a four-minute clip and a face-refine/upscale pipeline that holds the entire segment in RAM. Run it on the whole file and your machine swaps until it dies. The fix isn't a bigger card, it's smaller units of work - and the genuinely annoying part of doing that by hand is the frame arithmetic. At 29.97fps, "10 seconds" isn't an obvious number of frames, and off-by-one at a boundary means a duplicated or dropped frame at every join.

    FxAiVideoSegmenterV1 (凤希AI - 视频分段器V1) does that arithmetic once, correctly, and hands you a list of segment durations. It doesn't decode anything - that's the loader's job, one segment at a time.

    How it works

    It runs ffprobe on the file to get fps, frame count and dimensions, then builds a list of (start_frame, frame_count) pairs. The 目标模型 dropdown decides the rounding:

    • 标准 - 平均分段时长 × 帧率, rounded to a frame. 10 seconds means the frame at 10.000s, next segment starts on the very next frame. No overlap, no gap.
    • LTX - each segment's frame count is aligned down to 8k+1, because LTX's latent stride is 8.
    • MiniMax - each segment is converted at H3's fixed 24fps into a 17k+5 grid and then back into source frames.

    All three land the boundaries on frame numbers, so walking the list to the end neither skips nor repeats a frame.

    Then it converts frames to seconds with five decimal places - not a frame list. That's deliberate: five decimals survive the round trip back to frames (226 frames at 30fps → 7.53333s → 226 again), so nothing drifts across a long run. It's also what the downstream save and generation nodes want, since they're driven by duration.

    It also decodes the audio for the span it will actually process, as one track.

    Inputs and outputs

    Required, and worth reading in order:

    • 视频文件 - an enum of video files under ComfyUI's input folder, so the panel gives you a picker rather than a path box. API callers pass the same relative path.
    • 关键帧JSON - the manual markers; hidden behind the timeline panel, which writes it for you. Defaults to [] (no manual cuts).
    • 跳过初始段 / 包含尾部段 - trim the start and/or end before splitting.
    • 是否平均分段 - off means "cut only at my keyframes".
    • 平均分段时长 - seconds per segment, default 10.
    • 目标模型 - 标准 / LTX / MiniMax.

    Seven outputs: 视频路径, 分段时长列表, 分段总数, 帧率, 分段信息 (a formatted table of every segment's frames and timecodes, capped at 60 lines), 音频, and 起始帧.

    分段总数 is what your loop's count takes. 起始帧 is the one people forget to wire - see below.

    Choosing the segment length

    The tooltip makes a point worth restating because it's counterintuitive: segment length doesn't change total compute. Total work is total frames × resolution, and splitting a 10-second block into two 5-second blocks finishes in about the same wall time. What it changes is:

    1. how long until the first result appears (halved),
    2. peak memory (roughly halved - for this pack's SeedVR2 stage, which holds a whole segment in RAM, that's the difference between working and not),
    3. how much you lose when something crashes.

    The cost is more seams: segments are hard-cut, with no cross-fade, so more boundaries means more chances to see a jump, and the face-refine stage's hysteresis resets at each one. Ten seconds if your machine can take it, five if you're memory-tight.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/fxai666/fxai-toolkit
    

    Then install ffmpeg so that ffmpeg and ffprobe both work from a terminal in the same environment ComfyUI runs in:

    ffmpeg -version && ffprobe -version
    

    This node calls both as subprocesses - no Python wrapper, no bundled binaries. On Windows, add the ffmpeg bin folder to PATH and restart; if it works in a normal terminal but not in ComfyUI, ComfyUI was started from somewhere else and didn't inherit the PATH.

    Where it bites

    "ffprobe 读不到这个视频". That's the probe failing: ffprobe missing from PATH, or the path you passed isn't under input/ and doesn't resolve. The error includes stderr, which usually says which.

    Hard-coded frame rates. 分段信息 prints the real fps - check it. A file ffprobe reports as 23.976 gets treated as its real value internally but the 帧率 output is rounded to an integer (24), because downstream save nodes work in integers.

    It re-runs every queue - it reports itself as always-changed, so the file gets re-probed each run. Cheap, just visible in the log.

    Skipping the initial segment shifts everything. Turn on 跳过初始段 and the segments no longer start at frame 0; the node tells the loader how far in to start via 起始帧. Wire it, or your picture is offset by exactly the amount you trimmed.

    Node not in the menu? Each node loads in its own try/except, logging ❌[凤希AI] 节点加载失败 on the console. Read that before reinstalling.

    Category凤希AI/视频

    Inputs (7)

    NameTypeDefaultDescription
    视频文件COMBOinput 目录下的相对路径(子目录/文件名)。 面板上点「选择视频」直接挑,不用手打。 走 API 调用时传同样的相对路径即可,不用知道服务器物理路径。
    关键帧JSONSTRING[]—
    跳过初始段BOOLEANfalse—
    包含尾部段BOOLEANtrue—
    是否平均分段BOOLEANtrue—
    平均分段时长FLOAT10.00每段多少秒。**它不改变总耗时** —— 总算力只看「总帧数 × 分辨率」,把一段切成两段,总时间几乎一样。 它改变的是另外三件事: 1. **第一个结果多久出来** —— 5 秒段出首片的时间是 10 秒段的一半; 2. **峰值内存** —— 直接减半(超分整段都放在内存里,这段是最吃内存的); 3. **失败代价** —— 崩了只丢一段。 代价:段边界变多。段与段之间是硬拼(没有交叉淡化),边界越多越可能看到一下跳变;人脸精修的滞回也会在边界处重置。 **建议**:长时间等待难受就调 5;追求最少接缝、机器内存够就留 10。
    目标模型COMBO标准标准 平均分段时长 × 帧率,四舍五入到帧。10 秒就是 10.000 秒那一帧收尾, 下一段从它的下一帧开始,首尾不重叠。 LTX 每段帧数向下对齐到 8k+1(LTX latent 步长 8)。 MiniMax 每段按 H3 固定 24fps 折算成 17k+5,再换回源视频帧数。 三种模式的段边界都落在帧号上,循环切完不漏帧、不重复。

    Outputs (9)

    NameTypeDescription
    视频路径STRING—
    分段时长列表LIST—
    分段总数INT—
    帧率INT—
    分段信息STRING—
    音频AUDIO—
    起始帧INT—
    原始宽度INT—
    原始高度INT—