How to Create Unlimited-Length Videos with Wan 2.1 ComfyUI Workflow [2025]

Esha
By Esha
7 Min Read

I’ve been playing around with ComfyUI lately, trying to figure out how to create an infinite video generation workflow. And guess what? I think I finally cracked it!

Whether you’re into text-to-video or image-to-video, this setup works like a charm. The key node we use here is called the “For Loop Start” node. this just means that our ComfyUI workflow will keep running over and over again until something tells it to stop.

And to wrap things up nicely, we’ve got the “For Loop End” node waiting at the finish line.

How to Control the Number of Loops

Now let me show you how to actually control how many times this loop runs. See this field labeled “Total”? You can manually set exactly how many loops you want — say, 4 times if that’s what your heart desires.

But here’s where things get interesting. What if you want a specific video duration — like 21 seconds? That’s when the Math Node comes to save the day.

Let me break down how this works:

We start by defining:

  • Our desired time (let’s say 15 seconds)
  • The FPS (I usually go with 24fps)
  • The length per clip (in my tests, about 97 frames)

Then we let the Math Node crunch some numbers for us:

  • Total Frames = A × B = 15 × 24 = 360 frames
  • Loop Count = 360 ÷ 97 ≈ 3.71 → rounded up to 4 loops

Depending on how overlaps are handled or how frame cutting is rounded, the final result might look closer to 12 seconds. These overlapping frames (the last 10 from one clip and the first 10 of the next) create that seamless blend between clips, avoiding any jarring cuts or sudden jumps.

Controlling Settings for Precision

And here’s the best part — the For Loop End node takes care of combining all these generated clips into one single, cohesive video. You’ll notice there’s this Settings section that makes your life way easier. Here you can set:

  • The resolution
  • The length of the video
  • The frame rate (FPS)
  • How many seconds long you want the final video to be
  • And importantly, you can define the overlap between clips

All of these settings help you maintain precise control over your output, making it super simple to generate exactly the kind of video you’re envisioning.

Setting Up the Model Section

Alright, let’s walk through how I actually set up this workflow in practice.

First up, you’ll see the Model Section . At the beginning, you can bypass all the loop groups and generate a video based on your preference — whether it’s text-to-video or image-to-video.

In the Model Group , you’ve got options! I personally love using the Wan 2.1 model , but you could also try the Fuxion x Wan model or the Ant Wan 2.1 model depending on what you’re going for.

If you’re feeling adventurous and want to create an image-to-video, just enable that section. Prefer text-to-video instead? Go for it! The beauty of this setup is that it’s completely customizable based on your needs.

Once you’re happy with your initial video output, that’s when you can enable the Loop Group section .

For the loop setup, we also use the Wan 2.1 VACE model . Just click “Run”, and based on however many loops you’ve set (like 4 loops in our example), the system will generate the video four separate times.

After the process wraps up, the For Loop End node does its magic by stitching all those clips together into one single video.

Changing Prompts to Avoid Repetition

Alright, so we’ve covered how the loop works and how to control the number of loops using the For Loop Start and For Loop End nodes.

But here’s the thing — if you use the same prompt every time, your video ends up repeating the same scene over and over again. And that’s not exactly what we’re going for.

So what do you do if you want to avoid repetition and make your video more dynamic?

Simple — manually change the prompt in each loop.

Let me show you how this works in practice.

In my example, I kept the first loop as-is — a man riding a bike with explosive effects in the background. But for the second loop, I changed the scene and added a new prompt: “fire on the bike.”

And guess what? It worked!

Around the 5-second mark, you can clearly notice the change in the scene. The model successfully generated fire effects around the bike based on our updated prompt.

However, in the next three loops, the fire effect became more consistent — basically staying the same throughout. This shows that the system reused the same visual theme once it was introduced.

Still, changing prompts like this gives you more creative freedom and allows you to generate videos that feel more natural and less repetitive.

Why This Workflow Works Well with Wan 2.1

I’ve tested this workflow with Wan 2.1 model consistently delivers high-quality results — especially when generating action-based scenes like explosions, movement, or transitions between visual elements.

Here are a few reasons why the Wan 2.1 model works well for this setup:

  • High frame consistency : Even when looping multiple times, the model maintains visual continuity across clips.
  • Smooth transitions : When overlapping frames are used, the model blends scenes naturally without jarring cuts.
  • Customizable prompts : Whether you’re using text or images, Wan 2.1 adapts well to changes and generates accurate outputs.
  • Stable performance : Even after 4+ loops, the model doesn’t degrade in quality, which is crucial for unlimited-time generation.

If you’re looking for even more flexibility, you can also try the Fusion x Wan 2.1 or Any Wan 2.1 models. These offer slightly different styles and may be better suited depending on your specific creative goals.

Free Download

Resource ready for free download! Sign up with your email to get instant access.
Share This Article
Follow:
Studied Computer Science. Passionate about AI, ComfyUI workflows, and hands-on learning through trial and error. Creator of AIStudyNow — sharing tested workflows, tutorials, and real-world experiments.
6 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *