ComfyUI Node

Convert Video (FFmpeg)

Re-encode video inside ComfyUI without turning it into a thousand frames

By San4itos·Created about a year ago·Updated 12 months ago· 5
Convert Video (FFmpeg)
  • video
  • audio
    filename_prefixVID_conv
    codeclibx264
    pixel_formatyuv420p
    crf23
    output_formatmp4
    audio_handlingcopy original
    audio_codecaac
    audio_bitrate192k
    output_file_opt-preset medium

    The sister node to this pack's frame saver, and the answer to "I have a video, I want a different video." Convert Video (FFmpeg) re-encodes an existing clip into a new codec, container, or quality level - shrink a 3 GB generated take down to something you can post, transcode to WebM for a site that hates MP4, strip the audio, or just clean up the colorspace. All without leaving the graph. It's the re-encode tool for the one workflow in ten where you don't start from frames.

    How it works - and why the input matters so much

    The clever part is that it has two paths, and which one you hit changes everything. Feed it a VIDEO from Load Video by Path (this same pack) and it hands the file path straight to FFmpeg: a real re-encode, no decode-to-frames detour. Feed it a VIDEO from ComfyUI's default video loader and it falls into a compatibility mode that decodes the clip into frames, dumps them as PNGs, and re-encodes them - correct, but it's the slow path, and the README is blunt that using the default loader is inefficient. If you came here from the sibling node, you already have the right feeder; the pack is designed so the fast path is the obvious one.

    It's a proper FFmpeg front-end otherwise: codec choices are libx264, libx265, libvpx-vp9, libsvtav1, and - new here, not on the save-frames node - copy, which is stream-copy mode: remux into a new container with zero re-encoding. Format-swapping an MP4 to MKV in seconds is a genuinely useful trick. pixel_format also gains a copy option, so you can leave the source alone.

    Inputs and outputs

    • video - the VIDEO input. Prefer the Load-Video-by-Path route; it's the whole point of that node.
    • filename_prefix - default VID_conv, appended with an auto-counter in ComfyUI/output.
    • codec / pixel_format / crf / output_format - same semantics as the save-frames node: yuv420p + libx264 + CRF 23 is the boring, correct baseline; drop CRF for quality, raise it for drafts. In copy mode the CRF and pixel-format settings are ignored, which is exactly what you want.
    • audio_handling - copy original, replace with new, or remove audio. This is where the only real trap lives (below).
    • audio_codec / audio_bitrate / output_file_opt - for the replacement track and any extra FFmpeg flags, one per line.

    It's an output node: nothing comes out of it, the file lands in your output folder and shows up as a preview, and you can press Q in the queue to view it.

    The traps

    Two, both real, both from the source rather than the README. First: in the fast direct-path mode, "replace with new" audio doesn't actually work - the code logs a warning and copies the original audio track instead. The audio-replacement path only functions in the slow decode-to-frames mode. If you specifically need to swap the soundtrack, wire the default loader and accept the slowness, or just do it in FFmpeg on the command line. Second: on Windows, workflow metadata embedding is skipped in direct-path mode to dodge command-line length limits - the file comes out without the embedded workflow. Cosmetic, but it'll confuse you if you expect the round-trip.

    And the standing gotcha from the save-frames node applies here too: FFmpeg has to exist. It's resolved from ffmpeg_config.ini, the node's ffmpeg_bin/ folder, or your system PATH, in that order - and if none of them work, every convert fails with an FFmpeg-not-found error. Install is the same as the rest of the pack: ComfyUI Manager, search "Save Images to Video", or clone https://github.com/San4itos/ComfyUI-Save-Images-as-Video into custom_nodes and pip install -r requirements.txt (just Pillow - no model files, no heavy deps). For a tiny niche pack it does one job properly: don't use it for frame-heavy work, use it for the moment your generated clip needs to become a different file.

    CategorySan4itos

    Inputs (11)

    NameTypeDefaultDescription
    videoVIDEO
    filename_prefixSTRINGVID_conv
    codecCOMBOlibx2645 options: libx264, libx265, libvpx-vp9, libsvtav1, copy
    pixel_formatCOMBOyuv420p7 options: yuv420p, yuv422p, yuv444p, yuv420p10le, yuv422p10le, rgb24, +1
    crfINT230–63
    output_formatCOMBOmp45 options: mp4, webm, mov, avi, mkv
    audio_handlingCOMBOcopy original3 options: copy original, replace with new, remove audio
    audiooptAUDIO
    audio_codecoptCOMBOaac3 options: aac, mp3, libopus
    audio_bitrateoptCOMBO192k6 options: 96k, 128k, 160k, 192k, 256k, 320k
    output_file_optoptSTRING-preset mediumCustom FFmpeg output options. One option per line, e.g., -preset slow

    Outputs (0)

    No outputs