All projects

Clipsmith: AI-Assisted Twitch Clip Pipeline

media-automationautomationrag-llm
Clipsmith: AI-Assisted Twitch Clip Pipeline hero

Local pipeline that turns a Twitch VOD into publish-ready 9:16 clips using Whisper + LLM selection.

Bounded cost by design: $0/clip on local Ollama, or ≤20 prompt-cached selection calls per VOD.

It's an active project mid-sprint, not a finished product.

Situation

Turning long streams into short vertical clips is repetitive, slow, and hard to prioritize without watching the whole archive.

Task

A local pipeline that finds the best moments and cuts publish-ready 9:16 clips, with no cloud subscription required.

Action

  • Built five deterministic signals (existing Twitch clips, !clip commands, chat-density bursts, transcript hype keywords, audio-RMS spikes) that score and deduplicate candidates within 60 s, normalize to [1,100], and spread the top ≤20 at least 120 s apart; the model never searches the full VOD.
  • Each candidate gets one cached LLM call over a 90-second transcript window with a strict JSON contract; bad parses are skipped, the run continues. Three providers fully wired: Anthropic (default, prompt-cached), OpenAI, and zero-key local Ollama.
  • Wired the same pipeline into a Typer CLI, a FastAPI service with SSE progress, and a Next.js approve/reject dashboard; the identical Docker image also runs as an ephemeral Azure ACI cloud-batch job.

How it works

Six stages run in sequence: five free deterministic signals reduce a multi-hour VOD to ≤20 moments, then the LLM adjudicates only those. The same pipeline runs from the local CLI, a FastAPI + Next.js dashboard, or a cloud-batch launcher on ephemeral Azure ACI.

Result

Shipped clipsmith-ai v0.2.1 to PyPI and Docker Hub with 193 tests and CI green on every push (ruff, mypy, pytest, bandit, pip-audit). Five free signals reduce any VOD to ≤20 candidates before the model runs; the LLM makes one cached call per candidate at cents each. All three providers fully wired: Anthropic by default, OpenAI as a drop-in, and Ollama for $0/clip fully local. The FastAPI service and Next.js dashboard run the same pipeline with SSE progress and an approve/reject loop; a cloud-batch path runs the identical Docker image on ephemeral Azure ACI with Drive upload and teardown.

The candidate funnel: five deterministic signals (existing clips +100, !clip +25, chat-density bursts, hype keywords, audio-RMS spikes) deduped within 60s, normalized to [1,100], greedily spread to the top 20 candidates ≥120s apart, then adjudicated by one cached LLM call each.
Five free signals reduce the VOD to ≤20 moments before the model is ever called; the expensive stage is last and smallest.
Three LLM providers behind one factory interface: Anthropic claude-sonnet-4-6 (default, explicit ephemeral cache_control), OpenAI gpt-4.1 (json_object), and Ollama llama3.1:8b (zero-key, $0/clip). All share retry, JSON contract, OTel and Prometheus instrumentation.
Three swappable providers, one interface; the cheapest runs the whole pipeline fully local at zero API cost.

Learning

The clips get good from the signal funnel and its plumbing (dedupe, normalization, time-spread), not from the model. The LLM is the last and cheapest step: a yes/no over ≤20 ninety-second windows, never a search over hours of footage. I built per-signal approval analytics and prompt A/B endpoints specifically because I refused to assume which signal earned its weight; instrumenting the question is the honest version of answering it.

Tech Stack

PythonFFmpegfaster-whisperchat-downloadertwitch-dlOpenAI/Anthropic/OllamaFastAPINext.js

Services

AI Media AutomationVideo ProcessingSpeech-to-Text PipelinesLLM-Assisted Content SelectionCreator Tooling

Status

Active