# AI Video Clipper

> A local-first clipper that turns long podcasts, interviews and lectures into reviewed 9:16 and 16:9 clips, with every cut traced back to the transcript, frames and audio behind it.

Find the moments that stand alone, and show why.

- URL: https://weaveward.com/work/ai-video-clipper
- Year: 2026
- Industry: Media and content
- Capabilities: AI solutions, Computer vision
- Technologies: Python, FFmpeg, faster-whisper, Silero VAD, sherpa-onnx, PySceneDetect, OpenCV, MediaPipe, YAMNet, Claude Code, Codex CLI, Pydantic, SQLite, yt-dlp

## The challenge

Long-form video is where the best material hides. A one-hour podcast, interview or webinar usually holds a handful of moments that would work on their own as short clips, but finding them means watching the whole recording, judging which passages make sense without the rest, cutting on clean word boundaries, reframing a wide shot for a phone screen and captioning it, every episode.

Most open-source clippers send isolated transcript chunks to a language model, crop one vertical output and verify little. The clips start mid-thought, answer a question the viewer never hears or cut away from the person speaking, and nobody can see why a moment was chosen.

## What we built

AI Video Clipper is a local-first command-line tool that turns long-form video, from a file or a YouTube link, into reviewed vertical and horizontal clips, each with the evidence and reasoning behind it.

- **Local media pipeline.** FFmpeg, faster-whisper word timestamps, Silero VAD, sherpa-onnx diarization, PySceneDetect scenes, YuNet and MediaPipe faces, and librosa and YAMNet audio events all run on the user's machine, so the video never leaves it
- **Bring-your-own reasoner.** Editorial decisions come from an agent CLI the user is already logged into, Claude Code or Codex CLI, from any other CLI through a command backend, or from a deterministic heuristic editor that makes no model calls at all
- **A context engine, not transcript chunks.** Raw evidence becomes sentences, speaker runs and topics, then a whole-video semantic map, then small per-decision context packs that grow only when the model asks for more
- **A candidate funnel.** Every sentence-aligned window that fits the target durations is narrowed by a local prefilter to 40, by batched AI discovery to 18, by deep verification to 8 and by ranking to 6, so the expensive reasoning only sees the strongest few
- **One edit decision list, any aspect ratio.** The same decisions render as 9:16, 16:9, 1:1 or a custom list, with crops that follow the active speaker, split screens for two speakers and blurred-background fits for slides
- **Word-highlight captions.** Four caption templates (bold-pop, clean, boxed and neon), a title overlay that wraps and shrinks inside the safe area, and `.srt`, `.vtt` and `.ass` files beside every clip
- **QA with targeted repair.** Each render is checked for cut-off speech, caption accuracy through a second transcription, sync, loudness, black frames and framing, and a failure repairs only the clip that failed
- **Human review.** Editors list ranked clips, open a clip's decision trail, trim, retitle, change a layout, approve, reject or add clips, and can render only what they approved
- **Usage reports.** Every job reports compute time per stage, cache hit rates, model calls and tokens, and CPU, RAM and GPU use, and writes an HTML review page with players, keyframes and scores

## How it works

### Extract the evidence

A local file, or a video downloaded once with yt-dlp, is decoded to 16 kHz mono audio and analysed on the machine: speech regions from VAD, a transcript with word timings from large-v3-turbo on CUDA or the small model on CPU, speaker turns, scene cuts with keyframes, face tracks with mouth activity, and audio events such as laughter, applause and music. These stages belong to the source video, so every later job on it reuses them.

### Build the context

The first layer turns raw evidence into sentences, paragraphs, pauses, speaker runs and topics, and contains diarization noise by relabelling short label flips inside another speaker's unfinished phrase. The second layer makes one model pass over a compact transcript to write a summary, topics, highlights, speaker roles and narrative units linked by what they depend on and what they pay off.

### Find and verify moments

The prefilter scores windows locally on hook cues, completeness, questions and answers, energy, audio events and dependency risk. AI discovery triages the survivors in batches of eight, then verification gives each candidate a context pack with its sentences, neighbours, topic, related narrative units and visual and audio notes. The model may ask for more context a bounded number of times, and a candidate that still lacks it is rejected as missing context.

### Rank and review

Model scores are blended with local measurements under configurable weights, with hard rules for cut-off starts and endings, duplicates and topics to avoid. The result is an edit decision list with bounds snapped between words, a title, a hook, hashtags and evidence references, which an editor can review before anything renders.

### Frame, render, check

For each clip and aspect, a framing plan follows the active speaker with hysteresis and smoothing, and switches to a split or fit layout when the shot calls for it. A NumPy and OpenCV compositor feeds a single FFmpeg encode with libass captions and two-pass loudness normalisation, and QA checks every render before it is exported.

## Engineering insights

The pipeline is a graph of cached, resumable stages. Deterministic local tools produce the evidence, the reasoner only makes editorial decisions over compact, timestamped context, and deterministic code turns those decisions into renders.

- **Content-addressed stages.** A stage's fingerprint hashes its version, the source file's SHA-256, the slice of configuration it reads and its dependencies' fingerprints. New caption colours only re-render, new scoring weights re-rank without a model call, and nothing re-transcribes unless the source changes; a test suite enforces that matrix
- **Crash-safe caching.** Stages write into a temporary directory and are renamed into place only once their manifest is complete, so an interrupted run never leaves a partial cache entry and the next run carries on from the last finished stage
- **Validated reasoning.** Every model answer is checked against a strict JSON Schema generated from Pydantic models, then against the context the model was shown, such as sentence ranges that must sit inside it. A bounded repair loop feeds validator errors back, and valid answers are cached in SQLite by prompt hash
- **Subscription-safe usage.** API key variables are stripped from the CLI environment unless explicitly allowed, so a run never switches to pay-as-you-go billing silently. Per-run call and prompt budgets apply, and a usage-limit error stops the run cleanly; resuming later reuses every cached answer
- **Measured end to end.** On a 21.4-minute interview with an RTX 2060, transcription ran at about 24 times realtime, the editorial pass took 14 Claude Code calls, all 12 renders passed QA after two automatic boundary repairs, and a second job on the same video made no model calls at all
- **Built for a locked-down Windows machine.** Smart App Control refuses unsigned native modules it has no reputation for, so dependencies are pinned to releases it accepts, mypy is built from source, and the tool names the refused file and the fix instead of printing a traceback

## Design system

The visual language lives where viewers and editors meet the tool: captions that stay readable on any footage, and a plain review page that keeps attention on the clips.

- **Colour.** Captions are white with a black outline. The default bold-pop template marks the word being spoken in highlight yellow, the neon template marks it in neon green, and the boxed template sets white text on an opaque black box. The review page uses a light grey page under white cards, green score bars, red QA issues and tinted status pills for approved, rejected and pending clips
- **Typography.** Captions and titles default to bold Arial, sized as a fraction of the frame height so every aspect ratio stays consistent. A vertical caption holds at most two lines of 22 characters, and titles wrap inside the safe area and shrink to 60% before an ellipsis is used
- **Components.** Four caption templates, a title overlay, four layouts (crop, split, fit and full), terminal tables for ranked clips and decision trails, and a static review page with players, keyframes, scores, transcripts and the exact review commands for each clip
- **Accessibility.** Every clip ships with burned-in captions for muted viewing plus `.srt` and `.vtt` files for platform captions. The outline or box keeps captions legible on any background, captions move to the seam in split layouts so they never cover a face, each render's captions are transcribed again to check them against the speech, and every status pill carries a text label as well as a colour

## Where this fits

Teams that publish long-form video, such as podcasts, webinars, lectures or interviews, can turn each episode into reviewable short clips without sending the footage to a third-party service, and the same evidence-first pattern suits any AI workflow where a model makes judgement calls that people need to check. Explore our [AI solutions](/services/ai-solutions) and [computer vision](/services/computer-vision) work, or [talk to us about your content](/contact).
