Nodes/ComfyUI-aihub-workflow-exposer/AIHub Action New Video Segment
ComfyUI Node

AIHub Action New Video Segment

Inserting a generated clip into the timeline next to a specific video segment

By otavanopisto·Created about a year ago·Updated 22 days ago· 7
AIHub Action New Video Segment
  • video
    actionAPPEND
    namenew video
    formatauto
    codecauto
    crf23
    reference_segment_id
    reference_segment_actionNEW_AFTER
    file_name
    autoplayfalse

    AIHub Action New Video Segment is AIHub Action New Video with a sense of where it belongs. The plain node just ships a generated clip back to the client; this one also says "place it before segment 4," "replace segment 2," or "slot it in after segment 1." That distinction is everything in a real video editor, where generation is usually one step of a multi-clip timeline rather than a one-shot render. Generate the missing shot, hand it back, and it lands exactly where the cut needs it.

    Pack context, briefly: it's from otavanopisto's ComfyUI-aihub-workflow-exposer, the bridge that turns ComfyUI into the generation engine inside another app. Expose nodes pull the current segment in from the client; action nodes push results back over the pack's own websocket (port 8111). This one is outbound, with extra placement instructions attached.

    How it works

    Identical encoding to New Video - re-encode the VIDEO through ComfyUI's video stack (format/codec/crf), stream the bytes to the client - but the websocket event is NEW_VIDEO_SEGMENT and the envelope additionally carries a reference_segment_id and a reference_segment_action. The client interprets those as instructions for where the new clip goes in its segment list, then handles the file storage per the action field.

    The inputs that matter

    • video (required) - the path of the video file to export.
    • reference_segment_id - which segment the new clip is positioned against. The client owns these ids; feed them in from an expose node or a condition.
    • reference_segment_action - NEW_AFTER, NEW_BEFORE, or REPLACE. Replace is the one you'll reach for when regenerating a specific shot: it swaps the referenced segment's content instead of inserting another clip.
    • format / codec - auto (pass through) or explicit mp4 / h264. Set them when your editor is picky about what it'll play.
    • crf - H.264 quality factor, 0–51, default 23. Lower is better quality. Only applies to codecs that support it.
    • action - file-level APPEND/REPLACE.
    • name / file_name / autoplay - same as the plain video node.

    No outputs - pure side effect.

    Installing it

    ComfyUI Manager (search "ComfyUI-aihub-workflow-exposer"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
    # restart ComfyUI
    

    No downloads - the pack rides on ComfyUI's existing video tooling.

    Where people get burned

    The same two traps as its siblings. First, reference_segment_id must be a real id from the client - an unknown reference usually means the segment gets placed wherever the client's fallback logic puts it, which is rarely where you wanted. Second, an empty video input returns early without a peep, and no connected aihub client means the clip goes into the void; check the connection before you start suspecting the node.

    Categoryaihub/actions

    Inputs (10)

    NameTypeDefaultDescription
    videoVIDEOnew_video.mp4The path of the video file to export
    actionCOMBOAPPENDIf append is selected, the video will be added a number to the name to make it unique, if replace is selected, the video will be replaced with the new one
    nameSTRINGnew videoThe name of the video to be used
    formatCOMBOautoThe format to save the video as.
    codecCOMBOautoThe codec to use for the video.
    crfINT230–51The Constant Rate Factor (CRF) to use for encoding quality (lower is better quality). Only used for certain codecs like H.264.
    reference_segment_idSTRINGThe reference segment id of the video layer
    reference_segment_actionCOMBONEW_AFTERSpecify the action to execute at the given segment id
    file_nameoptSTRINGThe filename to use, with the extension, if not given the name value will be used with the given format extension based on the mime type
    autoplayoptBOOLEANfalseIf true, the video segment will autoplay when added

    Outputs (0)

    No outputs