https://github.com/ShmuelRonen/ComfyUI-HunyuanVideoSamplerSave
A ComfyUI custom node implementation for optimized video generation and motion effects, designed to work with Hunyuan text-to-video models.
https://github.com/ShmuelRonen/ComfyUI-HunyuanVideoSamplerSave
Last synced: 3 months ago
JSON representation
A ComfyUI custom node implementation for optimized video generation and motion effects, designed to work with Hunyuan text-to-video models.
- Host: GitHub
- URL: https://github.com/ShmuelRonen/ComfyUI-HunyuanVideoSamplerSave
- Owner: ShmuelRonen
- License: mit
- Created: 2025-01-09T05:56:57.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-09T06:06:38.000Z (3 months ago)
- Last Synced: 2025-01-09T06:46:03.704Z (3 months ago)
- Language: Python
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-comfyui - **ComfyUI-HunyuanVideoSamplerSave** - to-video models. (All Workflows Sorted by GitHub Stars)
README
# ComfyUI-HunyuanVideoSamplerSave
A ComfyUI custom node implementation for optimized video generation and motion effects, designed to work with Hunyuan text-to-video models.
Image to Video:

Text to Video:
## Features
### HunyuanVideoSamplerSave
An optimized video sampler that extends ComfyUI's KSampler capabilities:
- Memory-efficient batch processing for video frames
- Progress tracking for long video generation tasks
- Optimized VRAM usage through sequential frame processing
- Interrupt-safe with proper memory management
- Compatible with all standard ComfyUI samplers and schedulers### ImageMotionInfluence
A powerful tool for creating motion sequences from static images:
- Horizontal panning effects with adjustable range
- Progressive zoom capabilities
- Seamless loop generation through mirror techniques
- Configurable frame count and motion parameters### ResizeImageForHunyuan
A specialized resizing tool optimized for Hunyuan video generation:
- Predefined aspect ratios optimized for home GPUs
- Multiple size options for each aspect ratio
- All dimensions properly aligned to 16x16 grid
- Multiple upscaling methods
- Crop control options### EmptyVideoLatentForHunyuan
A latent initialization tool specifically designed for Hunyuan video generation:
- Supports multiple optimized resolutions for home GPUs
- Common aspect ratios (16:9, 4:3, 3:2, 9:16, 3:4, 2:3)
- Memory-efficient latent generation
- Configurable video length and batch size
- All dimensions automatically aligned to model requirements## Installation
1. Clone this repository into your ComfyUI custom nodes directory:
```bash
cd ComfyUI/custom_nodes/
git clone https://github.com/ShmuelRonen/ComfyUI-HunyuanVideoSamplerSave.git
```2. Restart ComfyUI to load the new nodes.
## Usage
### Video Generation Workflow
1. **Image Motion Setup**
- Input: Any source image
- Configure motion parameters:
- move_range_x: Controls horizontal movement (-150 to 150)
- frame_num: Number of frames to generate (2 to 500)
- zoom: Progressive zoom effect (0.0 to 0.5)
- Output: Sequence of motion-affected images2. **Image Resizing**
- Use ResizeImageForHunyuan to ensure proper dimensions
- Select from optimized presets for your GPU
- Choose appropriate upscaling method3. **Latent Setup**
- Use EmptyVideoLatentForHunyuan to initialize latent space
- Select resolution from optimized presets
- Configure video length and batch size4. **Video Generation**
- Use HunyuanVideoSamplerSave with your text prompts
- The motion-influenced latents guide the video generation
- Adjustable parameters:
- Steps: Generation steps per frame
- CFG: Prompt influence strength
- Sampler and Scheduler selection
- Denoising strength## Parameters
### HunyuanVideoSamplerSave
- **model**: Loaded Hunyuan model
- **positive/negative**: Conditioning from text prompts
- **video_latents**: Input latent sequence
- **seed**: Generation seed for reproducibility
- **steps**: Number of sampling steps
- **cfg**: Conditioning strength
- **sampler_name**: Choice of sampling algorithm
- **scheduler**: Noise scheduler selection
- **denoise**: Denoising strength### ImageMotionInfluence
- **image**: Input source image
- **move_range_x**: Horizontal motion range
- **frame_num**: Number of frames to generate
- **zoom**: Zoom effect intensity### ResizeImageForHunyuan
- **image**: Input image to resize
- **size_preset**: Selection of predefined sizes (e.g., "384x216 (16:9)", "768x432 (16:9)")
- **upscale_method**: Choice of upscaling algorithm (nearest-exact, bilinear, area, bicubic)
- **crop**: Crop method selection (disabled, center)### EmptyVideoLatentForHunyuan
- **resolution**: Selection of optimized video resolutions
- **length**: Number of frames to generate
- **batch_size**: Number of videos to generate in parallel## Memory Optimization
The nodes implement several memory optimization strategies:
- Sequential frame processing
- Active memory management
- Intermediate result storage
- Garbage collection during processing
- Optimized resolution presets for home GPUs
- Proper dimension alignment for efficient processingThis allows for processing of longer sequences and higher resolution outputs compared to standard sampling approaches.
## Integration
This custom node is designed to work seamlessly with:
- ComfyUI's core components
- Hunyuan text-to-video models
- Standard VAE encoders
- Various sampling and scheduling methods## Requirements
- ComfyUI installation
- Compatible Hunyuan model
- Sufficient VRAM for video processing
- Python 3.x
- PyTorch## License
MIT