A talking portrait: FantasyTalking
Lesson "wrapper-fantasy", in the group WanVideoWrapper of the lesson list. Steps: 15.
Consent first
Only someone who agrees may be voiced this way, with their own voice or a voice you have permission for. Obtain permission for the source material and follow local law. See Content rules.
What you will be able to do
A portrait says a short voice recording. The graph is simpler than InfiniteTalk's, the clip shorter.
What you need
- Model files the lesson checks:
- Wan 2.1 image to video (i2v) 14B:
models/diffusion_models, for examplewan2.1_i2v_480p_14B_fp8_scaled.safetensors; - the umt5-xxl text encoder of Wan:
models/text_encoders, for exampleumt5_xxl_fp8_e4m3fn_scaled.safetensors; - the Wan 2.1 VAE (wan_2.1_vae):
models/vae, for examplewan_2.1_vae.safetensors; - clip_vision_h:
models/clip_vision, for exampleclip_vision_h.safetensors; - the FantasyTalking module:
models/diffusion_models, for examplefantasytalking_fp16.safetensors.
- Wan 2.1 image to video (i2v) 14B:
- Nodes: WanVideo Model Loader, WanVideo T5 Text Encoder Loader, WanVideo VAE Loader, WanVideo TextEncode, Load Image, Load CLIP Vision, WanVideo ClipVision Encode, FantasyTalking Model Loader, WanVideo ImageToVideo Encode, Load Audio, (Down)load Wav2Vec Model, FantasyTalking Wav2Vec Embeds, WanVideo Sampler, WanVideo Decode, Create Video, Save Video.
- The app downloads and installs nothing. The step texts below say which files and folders, and which ComfyUI template names them.
The steps
The words of each step, as the lesson shows them. Node names are in bold.
What FantasyTalking does (reading)
FantasyTalking also teaches the Wan 2.1 "image to video" model to listen to sound, but it is built more simply than InfiniteTalk: a plain start from a picture, with no stitching of pieces. The clip comes out short, but the graph reads at a glance.
Only someone who agrees may be voiced this way, with their own voice or a voice you have permission for. Obtain permission for the source material and follow local law.
The lesson builds the graph from an empty canvas: "File ▸ New project".
Load the model
Add the node WanVideo Model Loader and choose in the field
modela Wan 2.1i2v14B model, preferably the 720p one.If the file you need is not in the list, your ComfyUI does not have it. The app downloads nothing. The easiest way is to open, in ComfyUI itself, the FantasyTalking example graph from the
example_workflowsfolder of the WanVideoWrapper pack: it shows which files are missing and where to put them. Then choose "Sync ▸ Sync now" in this app's menu, and the files appear in the lists.The text reader and the VAE
Add the nodes WanVideo T5 Text Encoder Loader and WanVideo VAE Loader. In the field
model_nameof the first choose the fileumt5-xxl-enc, of the second the filewan_2.1_vae.Describe the frame briefly
Add the node WanVideo TextEncode and connect the output of WanVideo T5 Text Encoder Loader to its input
t5. In the fieldpositive_promptsay who speaks and how: calmly, with a smile, with gestures.What is said the model takes from the sound, not from the text.
Load the portrait
Add the node Load Image and choose in the field
imagea portrait. A face seen large and from the front works best.Show the portrait to the model
Add the nodes Load CLIP Vision and WanVideo ClipVision Encode. In the field
clip_nameof the first choose the fileclip_vision_h. Connect its output to the inputclip_visionof the second, and the portrait to the inputimage_1.Add the FantasyTalking module
Add the node FantasyTalking Model Loader and choose in the field
modelthe file of the FantasyTalking module. Connect its output to the inputfantasytalking_modelof the model loader.Prepare the start
Add the node WanVideo ImageToVideo Encode. Connect the output of WanVideo VAE Loader to its input
vae, the portrait to the inputstart_image, and the output of WanVideo ClipVision Encode to the inputclip_embeds.Leave the field
num_framesat 81. At 23 frames a second that is three and a half seconds of speech.Load the voice
Add three nodes: Load Audio, (Down)load Wav2Vec Model and FantasyTalking Wav2Vec Embeds.
- In Load Audio choose in the field
audioa sound file from theinputfolder. - In (Down)load Wav2Vec Model set the field
modeltofacebook/wav2vec2-base-960h: FantasyTalking was trained with it. The node downloads this model itself when the graph is first run in ComfyUI. - Three links go into FantasyTalking Wav2Vec Embeds:
wav2vec_modelfrom (Down)load Wav2Vec Model,fantasytalking_modelfrom FantasyTalking Model Loader, and the sound. - In FantasyTalking Wav2Vec Embeds set
fpsto 23, andnum_framesto the same number as in WanVideo ImageToVideo Encode.
- In Load Audio choose in the field
Add the sampler
Add the node WanVideo Sampler and connect to it:
- the model to the input
model; - the prompt to the input
text_embeds; - the output of WanVideo ImageToVideo Encode to the input
image_embeds; - the output of FantasyTalking Wav2Vec Embeds to the input
fantasytalking_embeds.
- Turn the result into frames
Add the node WanVideo Decode. Connect the output of the sampler to its input samples, and the output of WanVideo VAE Loader to the input vae.
- Assemble the clip
Add the nodes Create Video and Save Video: the frames into images, the clip into video. Set the field fps to 23, as the sound has.
- Put the sound into the clip
Connect the output of Load Audio to the input audio of Create Video.
Without it the clip is saved silent, though the lips move.
- If the lips miss the words (reading)
What to change in FantasyTalking Wav2Vec Embeds:
- the lips move weakly: raise
audio_scaleto 1.2; - the face is frozen and only the lips move: set
audio_cfg_scaleto 2; the clip takes longer to compute; - the recording is longer than the clip: only its beginning is used. Cut the recording beforehand or raise
num_framesin both nodes.
For long speech take InfiniteTalk: it stitches a clip out of pieces.
- The graph is ready (reading)
Save the graph with "File ▸ Save workflow for ComfyUI…", open the file in ComfyUI and run it there. This app runs nothing in ComfyUI itself.
The first run takes longer than usual: the node (Down)load Wav2Vec Model downloads the speech model.
What the lesson checks
A reading step is done when you press Got it, next. A doing step ticks itself off when the canvas holds:
- Step 2, Load the model:
- a WanVideo Model Loader node.
modelof WanVideo Model Loader holds Wan 2.1 image to video (i2v) 14B; such a file lies inmodels/diffusion_models, for examplewan2.1_i2v_480p_14B_fp8_scaled.safetensors.
- Step 3, The text reader and the VAE:
- a WanVideo T5 Text Encoder Loader node.
- a WanVideo VAE Loader node.
model_nameof WanVideo T5 Text Encoder Loader holds the umt5-xxl text encoder of Wan; such a file lies inmodels/text_encoders, for exampleumt5_xxl_fp8_e4m3fn_scaled.safetensors.model_nameof WanVideo VAE Loader holds the Wan 2.1 VAE (wan_2.1_vae); such a file lies inmodels/vae, for examplewan_2.1_vae.safetensors.
- Step 4, Describe the frame briefly:
- a WanVideo TextEncode node.
wan_t5_modelof WanVideo T5 Text Encoder Loader intot5of WanVideo TextEncode.positive_promptof WanVideo TextEncode holds at least 3 characters and 2 real words.
- Step 5, Load the portrait:
- a Load Image node.
imageof Load Image: a value is chosen.
- Step 6, Show the portrait to the model:
- a Load CLIP Vision node.
- a WanVideo ClipVision Encode node.
CLIP_VISIONof Load CLIP Vision intoclip_visionof WanVideo ClipVision Encode.IMAGEof Load Image intoimage_1of WanVideo ClipVision Encode.clip_nameof Load CLIP Vision holds clip_vision_h; such a file lies inmodels/clip_vision, for exampleclip_vision_h.safetensors.
- Step 7, Add the FantasyTalking module:
- a FantasyTalking Model Loader node.
modelof FantasyTalking Model Loader intofantasytalking_modelof WanVideo Model Loader.modelof FantasyTalking Model Loader holds the FantasyTalking module; such a file lies inmodels/diffusion_models, for examplefantasytalking_fp16.safetensors.
- Step 8, Prepare the start:
- a WanVideo ImageToVideo Encode node.
vaeof WanVideo VAE Loader intovaeof WanVideo ImageToVideo Encode.IMAGEof Load Image intostart_imageof WanVideo ImageToVideo Encode.WANVIDIMAGE_CLIPEMBEDSof WanVideo ClipVision Encode intoclip_embedsof WanVideo ImageToVideo Encode.num_framesof WanVideo ImageToVideo Encode is from 49 to 121, a frame count of the form 4n + 1; Do this for me sets 81. Why: wan takes a number of frames of the form 4n + 1: 49, 81, 121. 81 frames at 16 per second make five seconds.
- Step 9, Load the voice:
- a Load Audio node.
- a (Down)load Wav2Vec Model node.
- a FantasyTalking Wav2Vec Embeds node.
wav2vec_modelof (Down)load Wav2Vec Model intowav2vec_modelof FantasyTalking Wav2Vec Embeds.modelof FantasyTalking Model Loader intofantasytalking_modelof FantasyTalking Wav2Vec Embeds.AUDIOof Load Audio intoaudioof FantasyTalking Wav2Vec Embeds.audioof Load Audio: a value is chosen.modelof (Down)load Wav2Vec Model isfacebook/wav2vec2-base-960h. Why: fantasyTalking was trained with this speech model; with another one the lips miss the words.fpsof FantasyTalking Wav2Vec Embeds is23. Why: fantasyTalking was trained at 23 frames per second; with another number the lips drift away from the words.num_framesof FantasyTalking Wav2Vec Embeds equalsnum_framesof WanVideo ImageToVideo Encode. Why: the sound is laid out on as many frames as the clip has, or the lips drift away from the words.
- Step 10, Add the sampler:
- a WanVideo Sampler node.
modelof WanVideo Model Loader intomodelof WanVideo Sampler.text_embedsof WanVideo TextEncode intotext_embedsof WanVideo Sampler.WANVIDIMAGE_EMBEDSof WanVideo ImageToVideo Encode intoimage_embedsof WanVideo Sampler.fantasytalking_embedsof FantasyTalking Wav2Vec Embeds intofantasytalking_embedsof WanVideo Sampler.
- Step 11, Turn the result into frames:
- a WanVideo Decode node.
samplesof WanVideo Sampler intosamplesof WanVideo Decode.vaeof WanVideo VAE Loader intovaeof WanVideo Decode.
- Step 12, Assemble the clip:
- a Create Video node.
- a Save Video node.
IMAGEof WanVideo Decode intoimagesof Create Video.VIDEOof Create Video intovideoof Save Video.fpsof Create Video is23. Why: fantasyTalking was trained at 23 frames per second; with another number the lips drift away from the words.
- Step 13, Put the sound into the clip:
AUDIOof Load Audio intoaudioof Create Video.
Mistakes people make
- Different
num_framesin the start and the sound nodes. - A recording longer than the clip: only its beginning is used.
- For long speech, use InfiniteTalk instead.