https://github.com/Comfy-Org/ComfyUI/issues/new/choose

Open
#18,050 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
1/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
python
Domain
ai, content

Research direction

The report contains a Google Colab video-generation script, but does not describe a change to ComfyUI or identify any project files or tests. Start by clarifying the intended behavior and how it relates to ComfyUI; there is no actionable completion criterion in the issue as written.

Written by the indexing model from the issue text.

Description

Potential Bug
Custom Node Testing
Expected Behavior

Free auto video maker: AI images (Pollinations) + AI voice (edge-tts) + zoom + captions

Run in Google Colab. First cell:

!pip -q install edge-tts "moviepy==1.0.3" pillow requests nest_asyncio

import asyncio, io, os, time, requests, numpy as np
import nest_asyncio
from urllib.parse import quote
from PIL import Image, ImageDraw, ImageFont
import edge_tts
from moviepy.editor import VideoClip, AudioFileClip, concatenate_videoclips

nest_asyncio.apply() # lets asyncio.run work inside Colab

W, H = 1280, 720
STYLE = "anime style, 90s cel-shaded, vibrant colors, cinematic, no text, no watermark, no logo"
VOICE = "en-US-GuyNeural"
OUTPUT = "ninja_boy_video.mp4"

(narration, image prompt). Edit these to change the video.

SCENES = [
("A boy with no family. A village that avoids him.",
"lonely spiky-haired blond ninja boy in orange outfit on a swing at sunset, village behind him"),
("And a monster sealed inside him.",
"glowing red chakra energy swirling behind a boy's silhouette, dramatic dark sky"),
("He is determined to become the greatest ninja in the village.",
"young ninja classroom, blond kid grinning proudly while others look away"),
("Along the way he finds rivals, mentors, and friends who become his family.",
"two rival ninja boys clashing mid-air above a waterfall, speed lines"),
("Then the stakes explode: huge wars, painful losses, and betrayals that hit hard.",
"vast dawn battlefield, hundreds of ninjas charging, dust and explosions, epic wide shot"),
("He never gives up, and he never breaks a promise. Start watching today.",
"blond ninja on a rooftop at sunrise, forehead protector glinting, confident smile"),
]

os.makedirs("work", exist_ok=True)

def fallback_image():
g = np.linspace(20, 200, H).astype("uint8")[:, None, None] * np.ones((1, W, 3), "uint8")
return Image.fromarray(g.astype("uint8"))

def get_image(prompt, i):
url = (f"https://image.pollinations.ai/prompt/{quote(prompt + ', ' + STYLE)}"
f"?width={W}&height={H}&nologo=true&seed={i + 7}")
for attempt in range(4):
try:
r = requests.get(url, timeout=120)
r.raise_for_status()
return Image.open(io.BytesIO(r.content)).convert("RGB").resize((W, H))
except Exception as e:
print(f" Image attempt {attempt + 1} failed: {e}")
time.sleep(5 * (attempt + 1))
print(" Using gradient fallback")
return fallback_image()

def add_caption(img, text):
img = img.copy()
d = ImageDraw.Draw(img, "RGBA")
try:
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 38)
except Exception:
font = ImageFont.load_default()
lines, cur = [], ""
for word in text.split():
if d.textlength((cur + " " + word).strip(), font=font) > W - 160:
lines.append(cur.strip())
cur = word
else:
cur += " " + word
lines.append(cur.strip())
h = len(lines) * 50 + 30
d.rectangle([0, H - h - 30, W, H], fill=(0, 0, 0, 150))
for k, line in enumerate(lines):
tw = d.textlength(line, font=font)
d.text(((W - tw) / 2, H - h - 10 + k * 50), line, font=font, fill="white")
return img

def zoom_clip(img, duration, zoom_in=True):
def frame(t):
p = min(t / duration, 1.0)
s = 1 + 0.12 * (p if zoom_in else 1 - p)
cw, ch = int(W / s), int(H / s)
x, y = (W - cw) // 2, (H - ch) // 2
return np.array(img.crop((x, y, x + cw, y + ch)).resize((W, H), Image.BILINEAR))
return VideoClip(frame, duration=duration)

async def make_voice(text, path):
await edge_tts.Communicate(text, VOICE, rate="+5%").save(path)

clips = []
for i, (text, prompt) in enumerate(SCENES):
print(f"Scene {i + 1}/{len(SCENES)}")
ap = f"work/v{i}.mp3"
asyncio.run(make_voice(text, ap))
audio = AudioFileClip(ap)
audio = audio.subclip(0, max(audio.duration - 0.05, 0.1)) # avoid read-past-end errors
img = add_caption(get_image(prompt, i), text)
clip = zoom_clip(img, audio.duration + 0.4, zoom_in=(i % 2 == 0)).set_audio(audio)
clips.append(clip)
time.sleep(3) # be gentle with the image API

final = concatenate_videoclips(clips, method="compose").fadein(0.5).fadeout(0.8)
final.write_videofile(OUTPUT, fps=24, codec="libx264", audio_codec="aac")
print(f"Done: {OUTPUT}")

Actual Behavior

Kind behavior to his family

Steps to Reproduce

Powerful

Debug Logs
# Free auto video maker: AI images (Pollinations) + AI voice (edge-tts) + zoom + captions
# Run in Google Colab. First cell:
#   !pip -q install edge-tts "moviepy==1.0.3" pillow requests nest_asyncio
import asyncio, io, os, time, requests, numpy as np
import nest_asyncio
from urllib.parse import quote
from PIL import Image, ImageDraw, ImageFont
import edge_tts
from moviepy.editor import VideoClip, AudioFileClip, concatenate_videoclips

nest_asyncio.apply()  # lets asyncio.run work inside Colab

W, H = 1280, 720
STYLE = "anime style, 90s cel-shaded, vibrant colors, cinematic, no text, no watermark, no logo"
VOICE = "en-US-GuyNeural"
OUTPUT = "ninja_boy_video.mp4"

# (narration, image prompt). Edit these to change the video.
SCENES = [
    ("A boy with no family. A village that avoids him.",
     "lonely spiky-haired blond ninja boy in orange outfit on a swing at sunset, village behind him"),
    ("And a monster sealed inside him.",
     "glowing red chakra energy swirling behind a boy's silhouette, dramatic dark sky"),
    ("He is determined to become the greatest ninja in the village.",
     "young ninja classroom, blond kid grinning proudly while others look away"),
    ("Along the way he finds rivals, mentors, and friends who become his family.",
     "two rival ninja boys clashing mid-air above a waterfall, speed lines"),
    ("Then the stakes explode: huge wars, painful losses, and betrayals that hit hard.",
     "vast dawn battlefield, hundreds of ninjas charging, dust and explosions, epic wide shot"),
    ("He never gives up, and he never breaks a promise. Start watching today.",
     "blond ninja on a rooftop at sunrise, forehead protector glinting, confident smile"),
]

os.makedirs("work", exist_ok=True)


def fallback_image():
    g = np.linspace(20, 200, H).astype("uint8")[:, None, None] * np.ones((1, W, 3), "uint8")
    return Image.fromarray(g.astype("uint8"))


def get_image(prompt, i):
    url = (f"https://image.pollinations.ai/prompt/{quote(prompt + ', ' + STYLE)}"
           f"?width={W}&height={H}&nologo=true&seed={i + 7}")
    for attempt in range(4):
        try:
            r = requests.get(url, timeout=120)
            r.raise_for_status()
            return Image.open(io.BytesIO(r.content)).convert("RGB").resize((W, H))
        except Exception as e:
            print(f"  Image attempt {attempt + 1} failed: {e}")
            time.sleep(5 * (attempt + 1))
    print("  Using gradient fallback")
    return fallback_image()


def add_caption(img, text):
    img = img.copy()
    d = ImageDraw.Draw(img, "RGBA")
    try:
        font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 38)
    except Exception:
        font = ImageFont.load_default()
    lines, cur = [], ""
    for word in text.split():
        if d.textlength((cur + " " + word).strip(), font=font) > W - 160:
            lines.append(cur.strip())
            cur = word
        else:
            cur += " " + word
    lines.append(cur.strip())
    h = len(lines) * 50 + 30
    d.rectangle([0, H - h - 30, W, H], fill=(0, 0, 0, 150))
    for k, line in enumerate(lines):
        tw = d.textlength(line, font=font)
        d.text(((W - tw) / 2, H - h - 10 + k * 50), line, font=font, fill="white")
    return img


def zoom_clip(img, duration, zoom_in=True):
    def frame(t):
        p = min(t / duration, 1.0)
        s = 1 + 0.12 * (p if zoom_in else 1 - p)
        cw, ch = int(W / s), int(H / s)
        x, y = (W - cw) // 2, (H - ch) // 2
        return np.array(img.crop((x, y, x + cw, y + ch)).resize((W, H), Image.BILINEAR))
    return VideoClip(frame, duration=duration)


async def make_voice(text, path):
    await edge_tts.Communicate(text, VOICE, rate="+5%").save(path)


clips = []
for i, (text, prompt) in enumerate(SCENES):
    print(f"Scene {i + 1}/{len(SCENES)}")
    ap = f"work/v{i}.mp3"
    asyncio.run(make_voice(text, ap))
    audio = AudioFileClip(ap)
    audio = audio.subclip(0, max(audio.duration - 0.05, 0.1))  # avoid read-past-end errors
    img = add_caption(get_image(prompt, i), text)
    clip = zoom_clip(img, audio.duration + 0.4, zoom_in=(i % 2 == 0)).set_audio(audio)
    clips.append(clip)
    time.sleep(3)  # be gentle with the image API

final = concatenate_videoclips(clips, method="compose").fadein(0.5).fadeout(0.8)
final.write_videofile(OUTPUT, fps=24, codec="libx264", audio_codec="aac")
print(f"Done: {OUTPUT}")
Other

Hero of the village

Dominant language
Python
Stars
150k
Forks
17.9k
Avg merge
1d 1h
Merged PRs (30d)
181

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Comfy-Org/ComfyUI

All issues in Comfy-Org/ComfyUI

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.