ComfyUI/comfy
guill 68f0d35296
Add support for VIDEO as a built-in type (#7844)
* Add basic support for videos as types

This PR adds support for VIDEO as first-class types. In order to avoid
unnecessary costs, VIDEO outputs must implement the `VideoInput` ABC,
but their implementation details can vary. Included are two
implementations of this type which can be returned by other nodes:

* `VideoFromFile` - Created with either a path on disk (as a string) or
  a `io.BytesIO` containing the contents of a file in a supported format
  (like .mp4). This implementation won't actually load the video unless
  necessary. It will also avoid re-encoding when saving if possible.
* `VideoFromComponents` - Created from an image tensor and an optional
  audio tensor.

Currently, only h264 encoded videos in .mp4 containers are supported for
saving, but the plan is to add additional encodings/containers in the
near future (particularly .webm).

* Add optimization to avoid parsing entire video

* Improve type declarations to reduce warnings

* Make sure bytesIO objects can be read many times

* Fix a potential issue when saving long videos

* Fix incorrect type annotation

* Add a `LoadVideo` node to make testing easier

* Refactor new types out of the base comfy folder

I've created a new `comfy_api` top-level module. The intention is that
anything within this folder would be covered by semver-style versioning
that would allow custom nodes to rely on them not introducing breaking
changes.

* Fix linting issue
2025-04-29 05:58:00 -04:00
..
cldm Replace print with logging (#6138) 2024-12-20 16:24:55 -05:00
comfy_types Add support for VIDEO as a built-in type (#7844) 2025-04-29 05:58:00 -04:00
extra_samplers Uni pc sampler now works with audio and video models. 2025-01-18 05:27:58 -05:00
image_encoders Fix for dino lowvram. (#7748) 2025-04-23 04:12:52 -04:00
k_diffusion CFG++ for gradient estimation sampler (#7809) 2025-04-28 13:51:35 -04:00
ldm Support HiDream E1 model. (#7857) 2025-04-28 15:01:15 -04:00
sd1_tokenizer Initial commit. 2023-01-16 22:37:14 -05:00
t2i_adapter Controlnet refactor. 2024-06-27 18:43:11 -04:00
taesd Improvements to the TAESD3 implementation. 2024-06-16 02:04:24 -04:00
text_encoders Add a T5TokenizerOptions node to set options for the T5 tokenizer. (#7803) 2025-04-25 19:36:00 -04:00
weight_adapter Support dora_scale on both axis (#7727) 2025-04-22 05:01:27 -04:00
checkpoint_pickle.py Remove pytorch_lightning dependency. 2023-06-13 10:11:33 -04:00
cli_args.py Add experimental --async-offload lowvram weight offloading. (#7820) 2025-04-26 16:11:21 -04:00
clip_config_bigg.json Fix potential issue with non clip text embeddings. 2024-07-30 14:41:13 -04:00
clip_model.py Support llava clip vision model. 2025-03-06 00:24:43 -05:00
clip_vision_config_g.json Add support for clip g vision model to CLIPVisionLoader. 2023-08-18 11:13:29 -04:00
clip_vision_config_h.json Add support for unCLIP SD2.x models. 2023-04-01 23:19:15 -04:00
clip_vision_config_vitl_336_llava.json Support llava clip vision model. 2025-03-06 00:24:43 -05:00
clip_vision_config_vitl_336.json support clip-vit-large-patch14-336 (#4042) 2024-07-17 13:12:50 -04:00
clip_vision_config_vitl.json Add support for unCLIP SD2.x models. 2023-04-01 23:19:15 -04:00
clip_vision_siglip_384.json Support new flux model variants. 2024-11-21 08:38:23 -05:00
clip_vision_siglip_512.json Support 512 siglip model. 2025-04-05 07:01:01 -04:00
clip_vision.py throw away alpha channel in clip vision preprocessor (#7769) 2025-04-23 21:28:36 -04:00
conds.py Remove unused function lcm in conds.py (#6572) 2025-01-23 05:54:09 -05:00
controlnet.py Slightly better fix for #7687 2025-04-20 11:33:27 -04:00
diffusers_convert.py Remove useless code. 2025-01-24 06:15:54 -05:00
diffusers_load.py load_unet -> load_diffusion_model with a model_options argument. 2024-08-12 23:20:57 -04:00
float.py Clamp output when rounding weight to prevent Nan. 2024-10-19 19:07:10 -04:00
gligen.py Lint and fix undefined names (1/N) (#6028) 2024-12-12 18:55:26 -05:00
hooks.py Hooks Part 2 - TransformerOptionsHook and AdditionalModelsHook (#6377) 2025-01-11 12:20:23 -05:00
latent_formats.py Initial Hunyuan3Dv2 implementation. 2025-03-19 16:52:58 -04:00
lora_convert.py Support the wan fun reward loras. 2025-04-07 05:01:47 -04:00
lora.py Support SimpleTuner lycoris lora format for HiDream. 2025-04-25 03:11:14 -04:00
model_base.py Support HiDream E1 model. (#7857) 2025-04-28 15:01:15 -04:00
model_detection.py Support for WAN VACE preview model. (#7711) 2025-04-21 14:40:29 -04:00
model_management.py Fix stream priority to support older pytorch. (#7856) 2025-04-28 13:07:21 -04:00
model_patcher.py Call unpatch_hooks at the start of ModelPatcher.partially_unload (#7253) 2025-03-16 06:02:45 -04:00
model_sampling.py Save v pred zsnr metadata (#7840) 2025-04-28 13:03:21 -04:00
ops.py Make loras work with --async-offload (#7824) 2025-04-26 19:56:22 -04:00
options.py Only parse command line args when main.py is called. 2023-09-13 11:38:20 -04:00
patcher_extension.py Add prepare_sampling wrapper allowing custom nodes to more accurately report noise_shape (#7500) 2025-04-09 09:43:35 -04:00
rmsnorm.py Fix issue on old torch. 2025-04-16 04:53:56 -04:00
sample.py Auto reshape 2d to 3d latent for single image generation on video model. 2024-12-29 02:26:49 -05:00
sampler_helpers.py Add prepare_sampling wrapper allowing custom nodes to more accurately report noise_shape (#7500) 2025-04-09 09:43:35 -04:00
samplers.py CFG++ for gradient estimation sampler (#7809) 2025-04-28 13:51:35 -04:00
sd1_clip_config.json Fix potential issue with non clip text embeddings. 2024-07-30 14:41:13 -04:00
sd1_clip.py Add a T5TokenizerOptions node to set options for the T5 tokenizer. (#7803) 2025-04-25 19:36:00 -04:00
sd.py Add a T5TokenizerOptions node to set options for the T5 tokenizer. (#7803) 2025-04-25 19:36:00 -04:00
sdxl_clip.py Add a T5TokenizerOptions node to set options for the T5 tokenizer. (#7803) 2025-04-25 19:36:00 -04:00
supported_models_base.py Mixed precision diffusion models with scaled fp8. 2024-10-21 18:12:51 -04:00
supported_models.py Support for WAN VACE preview model. (#7711) 2025-04-21 14:40:29 -04:00
utils.py Support LTXV 0.9.5. 2025-03-05 00:13:49 -05:00