Nodes/ZZX Nodes/ZZX Preset File / 预设文件
ComfyUI Node

ZZX Preset File / 预设文件

Save your transcode settings once, reuse them forever

By ZZXYWQ·Created 2 years ago·Updated a day ago· 24
ZZX Preset File / 预设文件
  • settings
  • settings
  • preset_json
  • saved_path
◄modeload►
◄preset_file►
◄preset_json{}►

A transcode has a lot of knobs, and a workflow JSON only remembers the ones you left in that workflow. ZZX Preset File / 预设文件 is the boring fix: it writes the whole settings bundle to a JSON file on the server, and reads it back. Same container, same encoder, same subtitle rules across every project - and no chance of mis-clicking yuv420p10le because you were copying a graph at 1 a.m.

It's the one ZZX node whose output is not a media file. It produces settings, which feed the converter's settings input.

Two modes, one node

mode is load or save, and preset_file is a server-side path that must end in .json - that's checked, not suggested. A relative path resolves against the ComfyUI process's working directory, which on Windows portable is usually not what you expect, so type absolute paths.

In save, connect the settings output of ZZX Video Settings into this node's optional settings input, point preset_file at where you want it, queue, and the file gets written. The returned saved_path is the real location. The file isn't overwritten if it exists: the pack's output helper reserves an incrementing name (myprofile_0000.json, myprofile_0001.json, …), so saving repeatedly leaves you a little pile of presets rather than a fresh one. That's deliberate - nothing gets clobbered - but you'll want to keep half an eye on the folder.

One consequence of the save path being resolved through the same validator as everything else: the file contains every setting, defaults included, not just the handful you changed. It's verbose and it's honest, and it means loading it later reproduces exactly what you had, not a guess at what the defaults were in that version.

In load, the file is read (up to 1 MiB) and parsed through the same settings() function that the converters use. Unknown keys are a hard error - Unknown preset settings: ['qulaity'] - which is exactly the behaviour you want from a config file. Missing keys fall back to defaults, so hand-written partial presets are fine.

preset_json is the escape hatch: a JSON object in the widget itself, no file needed. It works in both directions - in load it's ignored in favour of the file, in save it's merged on top of the connected settings.

Outputs and how they wire

settings is the ZZX_TRANSCODE_SETTINGS bundle for a converter's optional settings input. preset_json is the same thing serialised back to text - handy for logging, or for feeding a converter's own preset_json input on a machine where the two nodes aren't adjacent. saved_path is a plain string with the file location.

Precedence, because this trips people up: the converter builds built-in preset → connected settings → preset_json, later winning. Since the bundle from this node carries all 40-odd fields, connecting it wipes out whatever preset you picked on the converter. Set the converter's preset to Custom when you're driving it from a preset file, or you'll spend ten minutes wondering why your 10-bit GPU profile became plain H.264.

The pack ships three partial examples in presets/ worth copying as a shape:

{
  "video_encoder": "hevc_nvenc",
  "pixel_format": "yuv420p10le",
  "quality": 25
}

That's a complete, valid preset. Three fields, everything else defaults.

Install

Manager: search ZZX (Comfy Registry: ComfyUI-ZZX). Manual:

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

Plus ffmpeg/ffprobe on PATH or ZZX_FFMPEG / ZZX_FFPROBE, then restart ComfyUI.

Small print

The node is an output node that reports itself as always-changed, so every queue executes it - in save mode that means a new numbered file per queue even if nothing changed. Cheap, but noisy.

And a save with nothing connected isn't magic: no settings input and empty preset_json writes the full defaults, which is a legal way to generate a starting template and an easy way to save a preset that does nothing you wanted.

CategoryZZX/Video Advanced

Inputs (4)

NameTypeDefaultDescription
modeCOMBOload2 options: load, save
preset_fileSTRING—
preset_jsonSTRING{}—
settingsoptZZX_TRANSCODE_SETTINGS—

Outputs (3)

NameTypeDescription
settingsZZX_TRANSCODE_SETTINGS—
preset_jsonSTRING—
saved_pathSTRING—