A clipping tool looks like a magic button: paste a YouTube URL, get twenty vertical clips with captions. The demo is easy. The part that decides whether the output is usable is a pipeline of six stages, and most of them are about not making obvious mistakes.
This is the pipeline we use at Cliper to turn long-form videos into short clips for TikTok, Reels, and Shorts.
1. Moment selection is a ranking problem
Transcription gives you text and timestamps. It does not tell you which ninety seconds are worth posting. The first stage is a scoring pass over candidate windows:
- Audio energy. Laughter, raised voices, pauses, and music changes are cheap signals.
- Transcript salience. Self-contained stories, concrete numbers, and strong claims score higher than throat-clearing.
- Visual change. Scene cuts and on-screen text often mark a new idea.
- LLM ranking. A model reads each candidate with a prompt that asks one question: would someone who has not seen the full video understand and care about this clip on its own?
The output is a list of windows with scores, not a single "best" clip. Users have different audiences, and the highest-scoring moment is not always the right one for a given channel.
2. Boundaries decide whether the clip feels professional
A great moment cut half a second late feels amateur. The boundary pass snaps each candidate to word-level timestamps:
- Start 0.3 to 0.8 seconds before the first word of the hook. Starting exactly on the word feels abrupt; starting three seconds early feels like dead air.
- End after the last complete thought, not at a fixed duration. A clip that stops mid-sentence is worse than a slightly long one.
- Keep a small tail so the audio does not cut off a consonant.
- If the speaker starts with "so" or "and", consider moving the start forward to the first substantive sentence.
This stage is mostly rules. The rules are boring, and they are the difference between a clip that feels edited and one that feels clipped.
3. Reframing: track the subject, then smooth the path
A 16:9 source has to become 9:16 without losing the person who is talking. The naive approach is a center crop. It fails the moment two people share the frame or the speaker moves.
The reframe pass detects faces per frame, picks the active speaker or the largest stable face, and computes a crop rectangle around it. Raw per-frame crops jitter, so the rectangle is smoothed over time and clamped to the source frame. When no face is detected, the crop falls back to the center with a slower easing curve.
The goal is not perfect cinematography. It is a crop that does not distract. If the viewer notices the camera moving, the reframe has failed.
4. Captions: timing, line breaks, and safe zones
Word-level timestamps make captions feel tied to speech, but timing alone is not enough:
- Line length. Two short lines read better than one long line on a phone. Break at phrase boundaries, not at a fixed character count.
- Reading speed. If a line needs more than about 15 characters per second, shorten it or split it.
- Safe zones. Platform UI covers the bottom and right edges. Captions that sit under the like button are technically rendered and practically invisible.
- Highlighting. A moving highlight on the current word helps, but constant animation pulls attention away from the face. One accent color and a simple scale are enough.
The renderer needs to know the target platform's safe area, not just the output resolution.
5. Rendering is a queue problem
The final stage is an ffmpeg filter graph: trim, scale, crop, overlay captions, normalize audio, encode. Two practical rules:
- Never render on the API server. Push jobs to workers with a bounded queue, and return a job id immediately.
- Make jobs idempotent. A retry should reuse the existing render, not start a second one. This matters when a user clicks export twice or a worker dies mid-encode.
Hardware encoding helps, but the bottleneck is usually the filter graph and disk I/O, not the encoder. Measure before optimizing.
6. QA: the metrics that catch bad clips
Before a clip reaches the user, a small QA pass checks:
- Does the first three seconds contain the hook, or does it start with setup?
- Does any caption overflow the safe area or the frame?
- Does the crop jump between frames?
- Is the audio normalized and free of clipping?
These checks are cheap and catch the failures users notice first.
The unglamorous conclusion
AI clipping is not one model. It is a ranking pass, a boundary pass, a tracking pass, a caption layout pass, and a render queue, with a QA layer that assumes each of them will fail sometimes.
We built Cliper around this pipeline. The interesting engineering is not the "generate clips" button. It is everything that happens between the button and a clip someone is willing to post.
If you are building something similar, I would be curious which stage gives you the most trouble: moment selection, reframing, or caption layout.

