Colafornia/short-video-generator-AI

Free open-source project designed for turning youtube-viedos into viral short videos. Highlight detection, subtitles, translation, voiceover, all in one for your content.

short‑video‑generator‑AI

What it is – An open‑source Python tool that turns a full‑length YouTube (or local) video into one or more vertical short clips (9:16, 1:1, etc.). It stitches together automatic transcription, AI‑driven highlight selection, optional AI‑generated hooks, and simple video rendering. The whole pipeline runs locally except for the LLM calls, which can use OpenAI, Gemini, or MuAPI.

Key features

  • One‑line CLIpython main.py <YouTube‑URL> produces ready‑to‑post shorts.
  • Web UI – a tiny local web page (shorts‑generator‑ui.html) lets you queue several videos and tweak flags visually.
  • Highlight detection – the transcript is scored (0‑100) by a language model on “virality” cues such as emotional peaks, quotables, or practical tips.
  • AI‑generated hook – an optional short intro created by the same LLM to grab attention.
  • Multi‑provider LLM support – OpenAI, Gemini, or MuAPI; you just set LLM_PROVIDER and the corresponding API key in a .env file.
  • Local Whisper transcription – uses faster‑whisper models (tiny → large‑v3) on CPU or CUDA.
  • Configurable output – number of clips (--n), aspect ratio, resolution, language, and whether to include the hook.

How it works

  1. Download the source video (YouTube or local path).
  2. Transcribe with faster‑whisper, producing a timestamped text file.
  3. Classify content type (podcast, interview, tutorial, etc.) via the chosen LLM to tailor the highlight prompt.
  4. Score transcript segments using a “virality framework” (hooks, emotional peaks, revelations, etc.) and return ranked candidates.
  5. Deduplicate overlapping candidates, keep the highest‑scoring ones.
  6. Select top‑N clips as specified by --n.
  7. Render each clip vertically, optionally prepend an AI‑generated hook, and save to the output/ folder.

Typical workflow

# clone & set up
git clone https://github.com/Colafornia/short-video-generator-AI.git
cd short-video-generator-AI
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt

# create .env with your LLM key(s)
cat > .env <<EOF
LLM_PROVIDER=openai
OPENAI_API_KEY=sk-…
LOCAL_WHISPER_MODEL=base
EOF

# generate 3 shorts from a YouTube video
python main.py "https://www.youtube.com/watch?v=abc123" --n 3 --ratio 9:16

For the web UI, run python3 server.py and serve the web/ folder, then open http://localhost:8000/shorts-generator-ui.html.

Who might use it

  • Content creators who want a free alternative to commercial short‑video generators (e.g., OpusClip, Vidyo.ai).
  • Small teams needing batch processing of existing long‑form videos into TikTok/YouTube‑Shorts format.
  • Developers who want an API‑first way to embed short‑clip generation in their own pipelines.

Limitations

  • Relies on an external LLM API for highlight scoring and hook generation; you need a paid key for OpenAI or MuAPI, while Gemini’s free tier is limited.
  • Quality of highlights depends heavily on the prompt design inside the repo; it may miss niche “viral” moments.
  • Video rendering is done with ffmpeg‑style commands under the hood, so performance is bound by your hardware.
  • No built‑in watermark removal for source videos; the tool simply crops the original footage.

License – MIT (free to use, modify, and redistribute).

Related

  • Project
  • Project
  • Project
  • Project