Nodes/ZZX Nodes/Video Format Converter
ComfyUI Node

Video Format Converter

The fix for 'my clip won't play anywhere'

By ZZXYWQ·Created 2 years ago·Updated a day ago· 24
Video Format Converter
    • output_filename
    • video_info
    ◄video_path►
    ◄output_enabled▾►
    ◄output_filename►
    ◄video_formatmp4►
    ◄codech264►
    ◄video_quality23►
    ◄frame_rate25►
    ◄opencl_accelerationdisable►
    ◄video_width1280►
    ◄video_height720►
    ◄scaling_filterbicubic►
    ◄processing_method▾►
    ◄audio_codecaac►
    ◄bit_rate192►
    ◄audio_channelsstereo►
    ◄sample_rate48000►
    ◄output_path►

    Some clips come out of a workflow in a shape nobody will accept: a weird container, a frame rate that stutters in the browser, audio at the wrong sample rate, or 1088 pixels of HEVC that Premiere shrugs at. Video Format Converter is the blunt instrument for that. It sits on the end of a graph, takes a file path on the ComfyUI machine, and re-encodes it into MP4/MOV/MKV/AVI at a fixed size, frame rate and audio profile.

    It's the older, simpler sibling of ZZX Advanced Converter, and it's been kept around so existing workflows don't break. If you're starting fresh and want resize/pad/crop control, subtle picture work, or presets, use the advanced node. If you just need "make this 1280×720 H.264 MP4 with stereo AAC," this one is three widgets shorter.

    How it works

    The node probes the source with ffprobe so it can report what went in, builds a filter chain (scale= with force-aspect-ratio when you pick crop, then setsar=1 so the output has square pixels), and encodes the first video stream plus the first audio stream if there is one. Quality is FFmpeg CRF for the software encoders and CQ for the NVENC ones.

    One thing worth knowing if you have old workflows: the numeric video_quality no longer means what it used to. Older releases fed that number into a bitrate formula; this version treats it as CRF/CQ, where lower is better quality and a bigger file. Same widget, opposite direction. Start at 23 and look at the output.

    Inputs and outputs

    video_path is an absolute path on the server - this node does not accept an IMAGE and it doesn't read your ComfyUI input folder unless you point at it. output_enabled is a real switch: set it to false and the node returns an empty path and an empty info dict without touching FFmpeg.

    video_format (avi/mov/mkv/mp4) plus codec (av1, h264, h264(NVENC), hevc, hevc(NVENC)) is a constrained pair - AVI only takes H.264, MOV refuses AV1. video_width/video_height come from a fixed dropdown list and both must be even; frame_rate is a dropdown, not a number.

    processing_method is where people get a surprise. fill stretches to the target dimensions and mangles the aspect ratio. crop scales up while preserving the ratio and then centre-crops. There's no letterbox option here - the advanced converter's pad is what you want for black bars. scaling_filter defaults to bicubic; lanczos is sharper if you're downscaling generated footage.

    Audio: audio_codec is copy/mp3/aac, bit_rate is 96/128/192, sample_rate 44100/48000, audio_channels original/mono/stereo. copy keeps the audio untouched and ignores all three of those other settings, so only use it when the source audio already fits the target container.

    Outputs: output_filename is the full path to the new file, and video_info is a VHS_VIDEOINFO dict with source_- and loaded_-prefixed keys - feed it to VideoHelperSuite's video-info node if you like. You don't need VHS installed to run the transcode itself.

    opencl_acceleration should be left at disable. It's a fossil from an earlier version; turning it on logs a warning and does nothing. Use an NVENC codec if you want GPU encoding.

    Install

    Manager: search ZZX (published to the Comfy Registry as ComfyUI-ZZX). Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ZZXYWQ/ComfyUI-ZZXYWQ
    python -m pip install -r ComfyUI-ZZXYWQ/requirements.txt
    

    Windows portable:

    python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-ZZXYWQ\requirements.txt
    

    This node only needs the Python standard library plus ffmpeg and ffprobe on PATH (or ZZX_FFMPEG / ZZX_FFPROBE set to the executables). Restart ComfyUI after installing or the node won't appear.

    Troubleshooting

    The output lands in output_path if you set one, otherwise in ComfyUI/output, auto-created, with an incrementing _0000 suffix so nothing is clobbered. Because it's an output node that reports float("nan") from IS_CHANGED, it re-runs on every queue and writes another file each time - that's the design, not a bug, but it fills a disk if you queue a hundred times.

    An odd source dimension or an odd number you type in errors out; the widget list is all even numbers, so you'd have to work at it.

    If the encode fails partway, the partial file is deleted rather than left as a usable-looking corpse. And if your source has multiple audio tracks, only the first one survives - check the source with ZZX Media Info before you blame the converter.

    CategoryZZX/Video

    Inputs (17)

    NameTypeDefaultDescription
    video_pathSTRING—
    output_enabledCOMBO2 options: true, false
    output_filenameSTRING—
    video_formatCOMBOmp44 options: avi, mov, mkv, mp4
    codecCOMBOh2645 options: av1, h264, h264(NVENC), hevc, hevc(NVENC)
    video_qualityINT235–40—
    frame_rateCOMBO259 options: 8, 15, 24, 25, 30, 50, +3
    opencl_accelerationCOMBOdisable2 options: enable, disable
    video_widthCOMBO128020 options: 272, 300, 320, 360, 400, 450, +14
    video_heightCOMBO72020 options: 272, 300, 320, 360, 400, 450, +14
    scaling_filterCOMBObicubic6 options: bilinear, bicubic, neighbor, area, bicublin, lanczos
    processing_methodCOMBO2 options: fill, crop
    audio_codecCOMBOaac3 options: copy, mp3, aac
    bit_rateCOMBO1923 options: 96, 128, 192
    audio_channelsCOMBOstereo3 options: original, mono, stereo
    sample_rateCOMBO480002 options: 44100, 48000
    output_pathSTRING—

    Outputs (2)

    NameTypeDescription
    output_filenameSTRING—
    video_infoVHS_VIDEOINFO—