Michael T. DeWitt

System Administrator

IT Consultant

Sysadmin

Infrastructure Engineer

Network Administrator

Michael T. DeWitt

System Administrator

IT Consultant

Sysadmin

Infrastructure Engineer

Network Administrator

Blog Post

Automate My Workflow: Streamline Your YouTube Shorts Factory with n8n

August 22, 2025 How To
Automate My Workflow: Streamline Your YouTube Shorts Factory with n8n

Introduction

Content creators and tech teams alike are stuck in a loop.

You either spend hundreds on tools like Synthesia or Pictory or waste time manually creating video content. But what if there was a smarter way?

If you’re in IT, DevOps, software, or AI—this guide is for you. We’ll show you how to build your own automated video system using n8n, Ollama, Edge-TTS, ComfyUI, and MoviePy. No subscriptions. Full control. All open source.

By the end of this guide, you’ll have a working YouTube Shorts engine that generates, edits, and uploads content while you sleep.


What is a YouTube Shorts Factory (and Why Build One Yourself)?

A YouTube Shorts factory is an automated pipeline that takes a topic, generates a script, creates visuals and audio, stitches everything into a short video, and uploads it to YouTube.

Most people pay $200+ a month for this. You’re going to do it for free with tools like:

  • n8n – Automates everything.
  • Ollama + Llama 3 – Generates scripts using local AI.
  • Edge-TTS – Converts text to natural voiceovers.
  • ComfyUI – Generates images from prompts.
  • MoviePy – Creates video files.
  • YouTube Node in n8n – Uploads your Shorts.

If you’re in tech, learning to connect open-source tools like these will sharpen your automation skills, improve your productivity, and give you complete control.


How to Build Your Own YouTube Shorts Factory

Step 1: Set Up Your Custom n8n Instance

This is your automation brain.

  1. Create a folder and add two files:
    • docker-compose.yml
    • Dockerfile

docker-compose.yml

version: '3.8'
services:
  n8n:
    build: .
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=changeme123
      - GENERIC_TIMEZONE=America/New_York
    volumes:
      - ./n8n_data:/home/node/.n8n
    extra_hosts:
      - "host.docker.internal:host-gateway"

Dockerfile

FROM n8nio/n8n:latest

USER root
RUN apt-get update \
 && apt-get install -y --no-install-recommends python3 python3-pip ffmpeg ca-certificates \
 && rm -rf /var/lib/apt/lists/* \
 && pip3 install --no-cache-dir edge-tts moviepy
USER node
  1. In the terminal, run:
docker-compose up -d
  1. Open http://localhost:5678 in your browser and log in with:
    • Username: admin
    • Password: changeme123

Now your automation engine is live.


Step 2: Build the Workflow in n8n

Your workflow will look like this:

[Trigger] → [Ollama Script] → [Edge-TTS Voice]
                   ↓
     [ComfyUI Generate Image] → [MoviePy Assemble]
                                   ↓
                            [YouTube Upload]

Step 3: Generate the Script with Ollama

  1. Install Ollama locally:
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull llama3
  1. Add an HTTP Request node in n8n.

Set it to:

  • POST to http://host.docker.internal:11434/api/generate
  • Add a header: Content-Type: application/json
  • Use this body:
{
  "model": "llama3",
  "prompt": "Write an engaging 30-second YouTube Shorts script about {{ $json.topic }}. Hook the viewer, surprise them, and end with a strong CTA. 75-100 words.",
  "stream": false
}

Now Ollama generates engaging, unique scripts for every video topic you feed it.


Step 4: Convert Script to Voice with Edge-TTS

  1. Add an Execute Command node.
  2. Use this command (writes text to file to avoid quote issues):
printf "%s" {{ $json.response.toString().jsonEscape() }} > /home/node/.n8n/script_{{ $runIndex }}.txt \
&& edge-tts --voice "en-US-AriaNeural" --text-file "/home/node/.n8n/script_{{ $runIndex }}.txt" \
--write-media "/home/node/.n8n/audio_{{ $runIndex }}.mp3"

Edge-TTS gives you realistic voiceovers in over 100 languages. Everything is saved to your shared folder.


Step 5: Generate Images with ComfyUI

  1. Clone and install ComfyUI:
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
pip install -r requirements.txt
  1. Download your chosen model (e.g., SDXL Base) with a Hugging Face token if needed:
cd models/checkpoints
huggingface-cli download stabilityai/stable-diffusion-xl-base-1.0 --include "*.safetensors"
  1. Configure ComfyUI to save images into your n8n shared folder by editing extra_model_paths.yaml:
comfyui:
  base_path: ./ 
  output_directory: ../n8n_data/ComfyUI_Output
  1. Start ComfyUI:
python main.py --listen --port 8188
  1. In n8n, use a sequence of nodes:
    • HTTP POST to /prompt with a workflow JSON (passing your text prompt in)
    • HTTP GET to /history/<client_id> to retrieve the filename

Prompt example:

{{ $node['HTTP Request'].json.response }}, cinematic lighting, high quality, 4k

This ensures you get the actual filename when the image is ready.


Step 6: Assemble the Video with MoviePy

  1. Save this script as ./n8n_data/create_video.py on your host:
from moviepy.editor import *
import argparse

def make_even(x):
    return int(x) if int(x) % 2 == 0 else int(x) - 1

parser = argparse.ArgumentParser()
parser.add_argument('--image', required=True)
parser.add_argument('--audio', required=True)
parser.add_argument('--output', default='shorts_video.mp4')
args = parser.parse_args()

audio = AudioFileClip(args.audio)
img = ImageClip(args.image).set_duration(audio.duration)

target_w, target_h = 1080, 1920
img = img.resize(height=target_h)

bg = ColorClip(size=(target_w, target_h), color=(0,0,0)).set_duration(audio.duration)
x = (target_w - img.w) // 2
y = (target_h - img.h) // 2

final = CompositeVideoClip([bg, img.set_position((x, y))]).set_audio(audio).fadein(0.5).fadeout(0.5)

final_w, final_h = make_even(final.w), make_even(final.h)
if (final.w, final.h) != (final_w, final_h):
    final = final.resize(newsize=(final_w, final_h))

final.write_videofile(args.output, fps=30, codec='libx264', audio_codec='aac', verbose=False)
  1. In n8n, use an Execute Command node:
python3 /home/node/.n8n/create_video.py \
--image "/home/node/.n8n/ComfyUI_Output/{{ $node['Retrieve Generated Image'].json.filename }}" \
--audio "/home/node/.n8n/audio_{{ $runIndex }}.mp3" \
--output "/home/node/.n8n/final_video_{{ $runIndex }}.mp4"

This gives you a complete short video—synced audio, proper 9:16 framing, and polished formatting.


Step 7: Upload to YouTube Automatically

  1. Add a YouTube Node in n8n.
  2. Connect your account with OAuth.
  3. Use these config values:
  • Operation: Upload
  • Title: {{ $json.topic }} - Mind-Blowing Facts!
  • Description: {{ $node['HTTP Request'].json.response }} 🔔 Subscribe for more! #Shorts #{{ $json.topic }}
  • Tags: {{ ['shorts', $json.topic, 'facts'] }}
  • Category: 22
  • Privacy: public
  • Video File Path: /home/node/.n8n/final_video_{{ $runIndex }}.mp4

Now your video uploads automatically.


Tips and Reminders for Building This System

  • Use host.docker.internal + extra_hosts for Linux containers to access host services like Ollama.
  • Ollama and ComfyUI run locally; Edge-TTS requires internet.
  • Add a Google Sheet or database for automated topic scheduling.
  • Use Whisper AI to auto-generate subtitles if needed.
  • Always test with safe sample topics before scaling up.

Closing Thoughts

You’ve just built an entire automated content system that others pay hundreds for—without paying a dime.

It’s fully customizable, scalable, and entirely yours. Whether you’re creating tech content, educational Shorts, or AI-powered storytelling—this workflow can handle it all.

Just imagine how much money I could save your company……. with my automation skills.

Related Posts
4 Comments
  • DH 10:31 pm September 1, 2025 Reply

    Just found your site—this n8n/Ollama Shorts factory guide is brilliant! An incredibly detailed, step-by-step tutorial for open-source video automation using ComfyUI. Cutting-edge, practical workflow building. Subscribed!

    • admin 1:22 pm September 2, 2025 Reply

      Thank you!

  • Melissa Rowe 10:32 pm September 16, 2025 Reply

    This n8n, Ollama, and ComfyUI pipeline is pure wizardry! My thumbs already hurt from uploading, but now they can take a spa day. You’ve officially put my manual workflow out of a job. Bonkers good automation!

Write a comment to DH Cancel Reply