Nodes/SmartSave/Smart Save (Video)
ComfyUI Node

Smart Save (Video)

One generation number for the MP4, the WebM and the workflow

By phibbyrizz·Created about a month ago·Updated 11 days ago· 4
Smart Save (Video)
  • images
  • audio
    ◄filename_prefixauto►
    ◄frame_rate24►
    ◄save_raw_mp4true►
    ◄save_webmtrue►
    ◄save_metadata_pngtrue►
    ◄webm_crf32►
    ◄positive_prompt►
    ◄subfolder►
    ◄ollama_modelllama3.2:3b►

    Video output is where ComfyUI's file handling gets genuinely annoying. A clip comes out as an .mp4 and a .webm that you can't match up, and none of the video formats can carry your workflow - so three weeks later you have a gorgeous clip and no idea what made it. Smart Save (Video) is one node that writes all three, names them consistently, and files them by subject.

    What comes out the other end

    Feed it the frame batch from any video model and you get:

    Raw Video/Subject_Name/Subject_Name_00004.mp4
    Raw Video/Subject_Name/Subject_Name_00004_workflow.png
    Webm/Subject_Name/Subject_Name_00004.webm
    

    Same counter on all three, because it takes the highest existing number across the MP4, WebM and PNG files in both folders and adds one. Later, if you're trying to remember how clip 4 was made, that _workflow.png is your answer - it carries the full ComfyUI prompt and workflow chunks, so dragging it onto the canvas restores the graph. That companion file isn't decoration: video containers have no PNG text chunks, so a video file is a metadata dead end.

    How it encodes

    Frames go out as raw RGB24 bytes piped straight into FFmpeg's stdin. The MP4 is libx264, -pix_fmt yuv420p, CRF 17, preset medium - hardcoded, not a widget. A deliberate master-file setting: bigger, near-lossless, widely compatible. The WebM is libvpx-vp9 in constant-quality mode (-b:v 0) with -crf from the webm_crf input, default 32. That's your sharing copy.

    Audio is optional and comes in as a ComfyUI AUDIO input. The node writes it to a temporary 16-bit WAV and gives the MP4 AAC at 192k and the WebM Opus at 128k. Both encodes use -shortest, so a soundtrack shorter than the picture can clip the tail - check the length of the audio you're feeding it before you blame the node.

    FFmpeg discovery is layered: the imageio-ffmpeg bundled binary first, then PATH, then a few common ComfyUI/portable locations. Since requirements.txt pins imageio-ffmpeg, most people never install system FFmpeg at all. If none of those resolve, the node raises a clear "could not find FFmpeg" error rather than writing a broken file.

    Inputs that matter

    images is the frame batch. frame_rate defaults to 24 and it's the one setting you should actually think about: it only decides playback speed, so if your model produced 16fps frames and you leave it at 24 the clip plays noticeably too fast. Set it to what the model actually generated.

    save_raw_mp4, save_webm and save_metadata_png are all on by default. Turn off the WebM and you skip the slowest part of the run by a mile - libvpx-vp9 here runs at FFmpeg's default speed with no -cpu-used tuning, so on CPU it can look like the workflow has hung when it's really just grinding through VP9. If you only care about the master, save the MP4 and the PNG and leave the WebM for the ones you actually want to post. webm_crf only affects the WebM; lower is better quality, and you don't need to touch it unless the default files look mushy.

    Hand it zero frames and you get a ValueError; that's usually a loader upstream returning nothing.

    Subject classification is the same local Ollama arrangement as the image node - llama3.2:3b, temperature 0.0, POSTing to 127.0.0.1:11434, with regex fallbacks and Unsorted when there's no evidence. positive_prompt, subfolder and ollama_model behave identically to Smart Save (Image), including the trap that catches everyone: positive_prompt is a forceInput, so there's no text field on the node. You wire it, or you let the fallback scrape your prompt JSON and hope.

    There are no outputs. RETURN_TYPES is empty and the function returns (). You get no filename string to wire into a preview, so if you want to watch the clip without leaving ComfyUI, keep a preview node on the same frames.

    Install

    Same pack, same one-time setup as Smart Save (Image). Manager: search ComfyUI-SmartSave. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/phibbyrizz/ComfyUI-SmartSave.git
    cd ComfyUI-SmartSave
    python -m pip install -r requirements.txt
    ollama pull llama3.2:3b
    

    Restart, and it appears under video/saving. If Ollama isn't running, everything lands in Unsorted.

    Gotchas

    If you use filename_prefix instead of the default auto, remember it's sanitised as a filename, so core saving's %date%/%NodeName.widget% tokens don't apply. subfolder is the manual override and skips classification for that run - much better than fighting the classifier when you already know what to call the folder.

    The whole frame batch is held in RAM as bytes before encoding, so very long clips cost memory on top of whatever your sampler was using. And if you're reorganising a library you already have, auto_sort.py in the same repo handles MP4, WebM, MOV and MKV, keeps related files at the same generation number, and won't move anything without --apply:

    python auto_sort.py --dir "path/to/ComfyUI/output"
    python auto_sort.py --dir "path/to/ComfyUI/output" --apply --verbose
    
    Categoryvideo/saving

    Inputs (11)

    NameTypeDefaultDescription
    imagesIMAGE—
    filename_prefixSTRINGauto—
    frame_rateINT241–120—
    save_raw_mp4BOOLEANtrue—
    save_webmBOOLEANtrue—
    save_metadata_pngBOOLEANtrue—
    webm_crfINT320–63—
    audiooptAUDIO—
    positive_promptoptSTRING—
    subfolderoptSTRING—
    ollama_modeloptSTRINGllama3.2:3b—

    Outputs (0)

    No outputs