Nodes/Bjornulf_custom_nodes/โš™๐Ÿ“น FFmpeg Configuration ๐Ÿ“นโš™
ComfyUI Node

โš™๐Ÿ“น FFmpeg Configuration ๐Ÿ“นโš™

One node to set codec, quality, and format for every video node

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
โš™๐Ÿ“น FFmpeg Configuration ๐Ÿ“นโš™
    • FFMPEG_CONFIG_JSON
    โ—„ffmpeg_pathffmpegโ–บ
    โ—„container_formatmkvโ–บ
    โ—„video_codeclibx265 (H.265)โ–บ
    โ—„presetveryslowโ–บ
    โ—„crf10โ–บ
    โ—„pixel_formatyuv444p10leโ–บ
    โ—„force_fps0.00โ–บ
    โ—„enabled_change_resolutionfalseโ–บ
    โ—„width0โ–บ
    โ—„height0โ–บ
    โ—„enable_change_audiofalseโ–บ
    โ—„audio_codecaacโ–บ
    โ—„enabled_audio_bitratefalseโ–บ
    โ—„audio_bitrate192kโ–บ
    โ—„enabled_static_video_bitratefalseโ–บ
    โ—„video_bitrate3045kโ–บ
    โ—„force_transparency_webmfalseโ–บ

    This node doesn't touch any video itself. It's a settings hub - you configure your FFmpeg encoding options once (codec, container, quality, resolution, audio, framerate), and it outputs them as a single FFMPEG_CONFIG_JSON string that the pack's actual video nodes consume. Instead of setting quality on every Convert Video, Concat Videos, or Concat from List node individually, you set it here and wire this one config into all of them.

    It's the "define once, apply everywhere" pattern for the Bjornulf video pipeline. If you find yourself re-typing the same codec and CRF on multiple nodes, this is the fix.

    How it works

    You fill in the encoding parameters you care about, and the node serializes them into a JSON blob. The consuming nodes (Convert Video, Concat Videos, Concat Videos from List) accept that blob on their FFMPEG_CONFIG_JSON input and translate it into actual FFmpeg flags. Think of it as a preset object passed by wire.

    The inputs that matter

    There are a lot of inputs, but a beginner only touches a few:

    • container_format - the output wrapper: mp4, mkv, webm, mov, avi (default mkv). mp4 for maximum compatibility, webm if you need transparency.
    • video_codec - the encoder. libx264 (H.264) for universal playback, libx265 (H.265) for smaller files (the default), or the *_nvenc options to encode on an NVIDIA GPU (much faster). There's also copy to avoid re-encoding.
    • crf - quality, where lower means better and bigger (1โ€“63, default 10). Around 18โ€“23 is a sane range for H.264/H.265; the default 10 is very high quality and large.
    • preset - encoding speed vs. compression efficiency (ultrafast โ€ฆ veryslow, default veryslow). Slower = smaller file for the same quality. Drop it to fast or medium if encoding is taking forever.

    The rest are opt-in and gated behind their own enable toggles: pixel_format, force_fps, resolution override (enabled_change_resolution + width/height), audio settings (enable_change_audio, audio_codec, audio_bitrate), a static video bitrate (enabled_static_video_bitrate + video_bitrate), force_transparency_webm, and ffmpeg_path if your FFmpeg isn't on the default PATH. Leave the disabled ones alone until you need them.

    Output is a single FFMPEG_CONFIG_JSON string. Fan it out to every video node you want governed by the same settings.

    How to install it

    ComfyUI Manager: search Bjornulf_custom_nodes, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    pip install -r Bjornulf_custom_nodes/requirements.txt
    

    Restart ComfyUI. You also need FFmpeg installed and on your PATH - the config node just describes settings; the real FFmpeg is what does the work.

    Common issues

    A few traps. If you pick an *_nvenc codec without a compatible NVIDIA GPU (or the right drivers), encoding fails - fall back to libx264/libx265. If you pick a codec/container combo that doesn't match (say VP9 in an mp4), FFmpeg complains; when in doubt, H.264 in mp4 just works. The default crf 10 + veryslow preset produces gorgeous, enormous, slow-to-encode files - for everyday use, bump CRF toward the high teens and loosen the preset.

    And the standing caveat for all the pack's video/FFmpeg nodes: they're built and tested mainly on Linux, per the author. On Windows, set an explicit ffmpeg_path if the node can't find FFmpeg, and don't be surprised by rough edges. The author also rewrote the FFmpeg nodes heavily over several releases, so stay on a current version.

    CategoryBjornulf

    Inputs (17)

    NameTypeDefaultDescription
    ffmpeg_pathSTRINGffmpegโ€”
    container_formatCOMBOmkv6 options: None, mp4, mkv, webm, mov, avi
    video_codecCOMBOlibx265 (H.265)9 options: Auto, copy, libx264 (H.264), h264_nvenc (H.264 / NVIDIA GPU), libx265 (H.265), hevc_nvenc (H.265 / NVIDIA GPU), +3
    presetCOMBOveryslow10 options: None, ultrafast, superfast, veryfast, faster, fast, +4
    crfINT101โ€“63โ€”
    pixel_formatCOMBOyuv444p10le8 options: None, yuv420p, yuv444p, yuv420p10le, yuv444p10le, rgb24, +2
    force_fpsFLOAT0.000โ€“240โ€”
    enabled_change_resolutionBOOLEANfalseโ€”
    widthINT00โ€“10000โ€”
    heightINT00โ€“10000โ€”
    enable_change_audioBOOLEANfalseโ€”
    audio_codecCOMBOaac7 options: None, copy, aac, libmp3lame, libvorbis, libopus, +1
    enabled_audio_bitrateBOOLEANfalseโ€”
    audio_bitrateSTRING192kโ€”
    enabled_static_video_bitrateBOOLEANfalseโ€”
    video_bitrateSTRING3045kโ€”
    force_transparency_webmBOOLEANfalseโ€”

    Outputs (1)

    NameTypeDescription
    FFMPEG_CONFIG_JSONSTRINGโ€”