Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 2.62 KB

File metadata and controls

102 lines (71 loc) · 2.62 KB

YTshorts

Tools for generating vertical short videos from scripts, stock clips, narration, and storyboard images.

What this repo includes

  • main.py: end-to-end pipeline using ChatGPT script generation, Pexels clips, ElevenLabs narration, Whisper subtitles, and final render.
  • local_render.py: local stitcher for your own input/*.mp4 clips + input/*.mp3 voiceover into a 1080x1920 subtitled short.
  • storyline_image_generator.py: generates/approves narration + storyboard images in storyline_images/<run>/.
  • runway_clip_generator.py: creates video clips from storyboard images via Runway API.
  • script_generator.py: helper class used for generating scripts with OpenAI.

Requirements

  • Python 3.11
  • FFmpeg installed and on PATH (required by MoviePy/Whisper)
  • ImageMagick installed
  • API keys (depending on workflow):
    • OpenAI
    • ElevenLabs
    • Pexels
    • Runway (only for runway_clip_generator.py)

Setup (Windows PowerShell)

cd E:\Code\YTshorts
.\venv311\Scripts\Activate.ps1
pip install --upgrade pip
pip install openai python-dotenv moviepy openai-whisper requests elevenlabs

If the venv does not exist:

python -m venv venv311
.\venv311\Scripts\Activate.ps1

Environment variables

  1. Copy .env.example to .env
  2. Fill in real values:
PEXELS_API_KEY=...
ELEVENLABS_API_KEY=...
OPENAI_API_KEY=...
RUNWAY_API_KEY=...

RUNWAY_API_KEY is only needed for Runway clip generation.

Usage

1) Local render from your own clips/audio

  1. Put source videos in input/ as .mp4
  2. Put one narration file in input/ as .mp3
  3. Run:
python local_render.py

Output: output/<audio_name>_local.mp4

2) Full automated short pipeline

python main.py

This is interactive and will prompt for topics/script choices.

3) Storyline + storyboard image generation

python storyline_image_generator.py --topic "Your story idea"

Optional flags:

  • --seconds-per-image 5
  • --style "cinematic, emotionally engaging, easy to follow"
  • --voice-id <ELEVENLABS_VOICE_ID>
  • --character bob
  • --resume-dir <existing_run_folder>

4) Runway image-to-video clip generation

python runway_clip_generator.py --project-dir "<run_folder_name>"

You can also pass an absolute project path. Optional flags include --model, --ratio, --duration, --poll-seconds, and --max-wait-seconds.

Directory notes

  • input/, output/, published/, storyline_images/, and elevenlabs_input/ are runtime folders.
  • They are kept in git with .gitkeep but their generated contents are ignored by .gitignore.