In this article, I will try generating videos using IP-Adapter with ComfyUI AnimateDiff.
“IP-Adapter” is a tool for using images as prompts in Stable Diffusion.
It allows you to generate images that are similar in characteristics to the input image, and it can also be combined with regular text prompts.
Necessary Preparations
Please refer to this for information on how to install the ComfyUI core. The following items need to be added to ComfyUI for this task.
-
We will use the following two:
ComfyUI-AnimateDiff-Evolved (AnimateDiff extension)
ComfyUI_IPAdapter_plus (IP-Adapter extension)
If you are using ComfyUI Manager, you can search for and install both via the Manager (Reference: Adding Custom Nodes).
This is a model for video generation used in AnimateDiff. Here, I will use “mm_sd_v14.ckpt”, which has significant movement. This model can generate videos up to 24 frames.
The save location is "/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models/".
Just like with ControlNet, you load and use the IP-Adapter model. Here, I will use the base model “ip-adapter_sd15.bin”.
The save destination is "/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/models/".
You will also use the "SD 1.5 model" as the image encoder.
The save destination is "/ComfyUI/models/clip_vision/".
Use whatever you like.
The save destinations are "/ComfyUI/models/checkpoints/" and "/ComfyUI/models/vae/".
Use whatever you like. It is easier to choose a square image. Since the encoder in Clip Vision performs a process to resize images to 224x224, you will need to make adjustments if you use a rectangular image (Reference).
If you want to generate natural animation, choose a reference image that matches the art style of the image generation model as closely as possible.
After loading the workflow, drag and drop the reference image into the "Load Image" node (or save it in the input folder beforehand).
Workflow
The workflow for this time is as follows. It is based on the sample from ComfyUI-AnimateDiff, with nodes related to IP-Adapter added.
Save it to your desktop and drag and drop it onto the ComfyUI screen to load the workflow.
Please modify each item such as the model name and prompt as necessary.
The initial settings are configured to generate a video with 16 frames (batch size).
You can adjust how strongly the reference image is reflected by changing the "weight" in the "Apply IPAdapter" node at the top left.
Output
When you execute "Queue Prompt," it will generate at a size of 512x512 and then upscale it by 1.5x. Please adjust the size and scale according to your GPU environment.
It consumes significantly more VRAM than standard AnimateDiff, so it seems necessary to keep the image size smaller than usual.
It might be more reasonable to handle upscaling separately in a workflow with IP-Adapter disabled.
Using with ControlNet
You can also use IP-Adapter in combination with ControlNet. The example below incorporates IP-Adapter into the workflow from this article.
Related Articles
Articles about ComfyUI AnimateDiff are summarized in the following note!