ComfyUI Node

Save AMD Video

Save video with the AMD audio bug already fixed

By trustypangolin·Created 5 months ago·Updated about a month ago· 0
Save AMD Video
  • video
    filename_prefixvideo/ComfyUI
    formatauto
    codecauto

    Here's a node that's exactly what its name says: it saves a video to your ComfyUI output directory, with a specific AMD GPU bug patched out. If you don't have an AMD GPU, this is just a regular Save Video node with extra steps. If you do - specifically if you've ever seen a crash or silent corruption when saving a video with audio on an AMD card - this is the node that exists because that bug was real and somebody got tired of it.

    The mechanism is worth understanding because it's the pack's cleverest bit of engineering. ComfyUI's video saving code has a line that moves an audio waveform tensor to CPU via .float().numpy(). On AMD/ROCm, that tensor can still be on the GPU when .numpy() is called, and numpy can't touch a GPU tensor - so you get a crash, or worse, audio that quietly doesn't make it into the file. The pack's amd_tools.py patches ComfyUI's own video_types.py at runtime: it wraps the save function and, if the audio waveform is a torch tensor on a non-CPU device, moves it to CPU first. One .cpu() call. That's the entire fix - but it's the difference between video-with-audio saving and not saving on ROCm systems.

    Inputs, all required:

    • video - the VIDEO tensor to save. This is the pack's VIDEO type, so wire it from a video-producing node (in this pack's world, typically a Replicate video model's output).
    • filename_prefix (default "video/ComfyUI") - where it lands in the output directory. The default gives you output/video/ComfyUI_xxxxx.mp4 style names.
    • format - auto or mp4. auto picks based on the container and defaults are sane; force mp4 if you need to be sure.
    • codec - auto or h264. Again, auto usually does the right thing; force h264 when a downstream tool is picky about codecs.

    It's an output node with no return values - it writes the file and finishes the branch. Nothing to wire onward.

    Install is the pack standard - ComfyUI Manager (search ComfyUI-API-DockerCPU), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/trustypangolin/ComfyUI-API-DockerCPU
    cd ComfyUI-API-DockerCPU
    pip install -r requirements.txt
    

    No API token needed - this is one of the pack's few purely-local nodes. Restart ComfyUI and it appears under 🎨 DockerCPU API/Utilities.

    The honest caveats: this node patches ComfyUI internals (comfy_api's video module), and the patch applies at runtime when you use the node. If ComfyUI updates and changes that module's structure, the patch can silently fail - the code catches exceptions and just prints a warning, meaning you'd get an unpatched Save Video in disguise. And for non-AMD setups it genuinely buys you nothing over ComfyUI's built-in save. Also worth knowing: because the pack is designed for CPU-only VMs where all generation is offloaded to APIs, most of the time this node is saving video that a Replicate or fal model produced - which is exactly when the AMD audio path can bite, since the video arrives with audio that has to be written back out. If that's your setup, this is the node to end the pipeline with.

    Category🎨 DockerCPU API/Utilities

    Inputs (4)

    NameTypeDefaultDescription
    videoVIDEOThe video to save.
    filename_prefixSTRINGvideo/ComfyUIThe prefix for the file to save.
    formatCOMBOautoThe format to save the video as.
    codecCOMBOautoThe codec to use for the video.

    Outputs (0)

    No outputs