Today, I’ll walk you through my experience using HunyuanVideo with Comfy UI and how I improved my results. Let’s get started!
The First Attempt: What Went Wrong?
So, I tried generating a video in ComfyUI, but the results weren’t great. The video looked blurry and lacked the sharpness I was hoping for. Meanwhile, I had another video processing on the HunyuanVideo website, and it already looked so much better. That’s when I realized: maybe my settings needed some tweaking.
Upscaling the Video
Upscaling is like giving your video a makeover. It enhances the resolution and makes everything look crisp and professional. Here’s how I did it:
- Load the Video:
I selected the video I had just generated in Comfy UI. - Set the Upscale Factor:
I chose an upscale factor of 2, which doubles the resolution. - Choose the Model:
I used the 4x Pool Hard Model for upscaling. This model is great for adding clarity and sharpness to videos. - Process the Video:
After running the upscale process, the video’s quality improved noticeably. The colors popped, and the details were even more refined.
Best Settings
I decided to experiment with the settings in Comfy UI, and here’s what worked for me:
- Resolution:
I set the resolution to 512 by 512 pixels. This size is manageable and still produces decent-quality videos. - Frame Steps:
I adjusted the steps to 30. This controls how detailed the video gets during processing. - Embedding Guidance Scale:
Setting this to 6 helped align the video more closely with my text prompt. - BF16 Mode:
I made sure all settings used BF16, which is a precision mode for faster and more efficient processing. - Video Settings:
- Bitrate: I kept this at 64 kbps.
- Frame Rate: Adjusted to 16 fps for smooth playback.
Handling Errors
Sometimes, things don’t go as planned. If you encounter an error like “device allocation failed,” don’t panic.
Here’s a quick fix:
- Cancel the process.
- Wait for 5 to 10 seconds.
- Try generating the video again.
Downloading and Setting Up Required Files
To make sure everything runs smoothly, you’ll need to download a few files and place them in the right folders in Comfy UI. Don’t worry—I’ll guide you step by step!
1. Transformer and VAE Files
- Download Location: Transformer and VAE Files on Hugging Face
- Where to Place Them:
- Save the hunyuan_video_720_cfgdistill_fp8_e4m file in the UNET folder in your ComfyUI directory.
- Save the hunyuan_video_vae_bf16.safetensors file in the vae folder in your Comfy UI directory.
These files won’t autodownload, so you need to grab them manually from the link above.
2. LLM Text Encoder
- Download Location: LLM Text Encoder on Hugging Face
- Where to Place It:
- Go to ComfyUI/models/LLM/ open in cmd
git clone https://huggingface.co/Kijai/llava-llama-3-8b-text-encoder-tokenizer
3. Clip Text Encoder
- Download Location: Clip Text Encoder on Hugging Face
- Open in cmd ComfyUI/models/
- type this and enter
git clone https://huggingface.co/openai/clip-vit-large-patch14
This also supports auto download, but you can manually download the files if needed.
Memory Usage and Resolutions
Here’s a quick tip:
The good news? This model can create functional videos even at low resolutions, so you don’t need a supercomputer to get started!
The memory usage depends on the resolution and frame count of your video.
Even on a system with 12 GB of VRAM, you might hit some limits if you push the resolution too high.