Nodes/ComfyUI Simple Batch/πŸ“€ Batch Save Audio
ComfyUI Node

πŸ“€ Batch Save Audio

Writing a whole folder of audio out, one re-queue at a time

By lordekeenΒ·Created 24 days agoΒ·Updated 20 days agoΒ· 1
πŸ“€ Batch Save Audio
  • audio
    β—„slot0β–Ί
    β—„total0β–Ί
    β—„relative_pathβ€”β–Ί
    β—„output_rootβ€”β–Ί
    β—„formatautoβ–Ί
    β—„filename_template{filename}β–Ί

    The output half of this pack's audio pair. BatchSaveAudio takes the processed AUDIO from the end of your chain, encodes it back to a file, and - like its image and video siblings - re-submits the same prompt at the front of the queue until the folder is exhausted. Wire it to BatchLoadAudio, set one required field, and a folder's worth of audio files process unattended.

    It writes to a tree that mirrors your source: output_root + relative_path, so subfolders stay subfolders and same-named files never collide. Encoding is done through PyAV, which ComfyUI already bundles - no extra install. FLAC, MP3, and WAV are the encode targets, and the important part is that channel count, sample rate, and duration survive the round-trip. Audio that went in stereo comes out stereo, not a doubled mono channel.

    The inputs that matter

    • audio - the processed audio from the end of the workflow.
    • slot, total, relative_path - wire from BatchLoadAudio. The node validates them and refuses to run if they're missing or mangled, so don't try to hand-feed this thing; that's the guardrail telling you the wiring is wrong.
    • output_root - required, absolute path. Empty here and the batch stops with a clear error. Keep it outside the folder you're reading from.
    • format - auto (default) keeps the source container and extension, or force flac / mp3 / wav / opus. auto is the honest choice: your WAV stays a WAV and your FLAC stays a FLAC, no surprise transcoding in the middle of a 400-file run.
    • filename_template - applied to the file stem only. Default {filename} reproduces the source name exactly; {date} gives you YYYY-MM-DD. The extension is always appended last from format, never the template.

    How it handles the batch loop

    Two triggers keep the loop going. Happy path: an item saves, more remain, the Save node re-queues the identical prompt at the front of the queue - ahead of anything you queued meanwhile, so the batch keeps priority over itself. Failure path: a node upstream crashes before the save ever runs, the JS watchdog catches ComfyUI's execution_error, the server logs one line to _simple_batch_log.txt inside output_root, drops a zero-byte .error marker next to where the output would have gone, and re-queues. The next run sees the marker and skips that item. One attempt per file, then logged and moved on - retry-forever loops are how batches become overnight disasters, and this pack deliberately doesn't do them. To retry a failed file, delete its .error marker. Cancel works as you'd hope: it stops the batch, doesn't log, doesn't requeue.

    One naming trap worth knowing: if your filename_template drops {filename} (say, a fixed name or {date} only), two items in the same subfolder can resolve to the same output. The first saves, the second is silently skipped as "already handled," and the pack appends one warning line to the log per distinct template so the risk is at least visible.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/lordekeen/comfyui-simple-batch
    

    Restart ComfyUI, or search ComfyUI Simple Batch in Manager. No pip install, no models to fetch - PyAV ships with ComfyUI and this pack doesn't add dependencies. You need a recent ComfyUI build (V3 API), Python 3.10+, and a sane output_root. That's the whole setup.

    Categoryaudio/batch

    Inputs (7)

    NameTypeDefaultDescription
    audioAUDIOThe processed audio from the end of the workflow.
    slotINT00-based index of the current audio (wire from Batch Load Audio).
    totalINT0Total matching file count (wire from Batch Load Audio).
    relative_pathSTRINGCurrent file's path relative to the input folder (wire from Batch Load Audio).
    output_rootSTRINGRoot of the destination tree (absolute path). Required.
    formatCOMBOautoOutput container. 'auto' keeps the source container and extension.
    filename_templateSTRING{filename}Output filename template, applied to the file stem. {filename} = original stem, {date} = YYYY-MM-DD.

    Outputs (0)

    No outputs