Skip to content
Rafi Akmal Widikta

fullstack

Fork

Cheat Clip PRO

Local video clipping tool with two workspaces that turns long videos into vertical clips for TikTok, Shorts, and Reels, with animated subtitles, face centering, and ranking compilations.

Role
Backend & Video Engineering + Frontend
Duration
June – October 2026
Date
October 2026

Technologies

  • python
  • fastapi
  • ffmpeg
  • openai-whisper
  • opencv
  • google-genai
  • yt-dlp
  • youtube-transcript-api
  • react
  • typescript
  • vite
  • server-sent events
  • css custom properties

Impact

43 endpoints across 6 routers, 11,526 lines of Python, and 22 TypeScript files with 16,956 lines, built over 178 commits.

The frontend workspace started as a fork of an existing codebase. The work described in that part is the development and fixes made on top of it; the backend pipeline and video engineering were built here.

Problem

Making short clips from long videos looks easy until three things appear. First, viral moments do not have clear boundaries: cutting in the middle of a sentence ruins the clip, and an absolute score threshold is unreliable because model scores depend on the video. Second, the rendered result has to match the preview: a shifted crop, a clipped label, or a duration off by a few seconds is immediately visible on the target platform. Third, video sources are not cooperative: YouTube limits downloads and embeds, and every failure has to be explainable to the user instead of ending as a 0-byte file.

The preview has its own hard constraint: YouTube can only be embedded at a 16:9 ratio, while the output is always vertical 1080×1920. A wrong crop, camera position, or canvas makes users see one thing and download another.

Solution

Analysis runs as a staged pipeline, not a single model call. The source is detected first, then the retention heatmap and transcript are collected: local Whisper for uploaded files, platform transcripts for YouTube, with proxies and player rotation because one path is not enough. Gemini only receives the timestamped transcript and picks moments; clip boundaries are snapped to sentence boundaries so no word is split. The list of Gemini models is discovered dynamically, sorted by version, and tried in order: a quota exhausted on one model is not a failure, and 429 is distinguished from 502 so the message to the user is honest.

Rendering is a single ffmpeg filtergraph assembled in full: 1080×1920 canvas, blurred background, face tracking (YuNet with a Haar cascade fallback), watermark, BGM, hook SFX, and hand-written ASS subtitles. Tags always stay inside the override block, and the font shrinks instead of clipping text. Every output is always re-encoded (libx264 + aac, setsar=1, 48 kHz stereo) so the next merge is precise; never -c copy.

Batch rendering has its own registry: per-clip progress, cancellation flags, retry per index, and a ZIP with title-based names plus .txt metadata so titles and hashtags do not have to be copied by hand. Ranking compilation adds a more complicated layer: an ASS overlay with fixed number slots, a weighted multimodal score that sums to 1.0, temporal IoU-based NMS over the windows that are actually rendered, and ascending order so the winner appears last.

The interface is two workspaces, Clip and Rank Clip, that share one data session through state-based navigation without a router. The preview uses two sources at once, the YouTube IFrame API and the direct video element, with one fixed rule: the iframe is always 16:9 and the wrapper does the cropping, because forcing the iframe to another ratio makes YouTube add internal letterboxing. The canvas follows the render model: the frame stays portrait for every vertical mode, only the content box changes (9:16, 1:1, 4:3, letterbox), and landscape is truly 16:9.

Playback is guarded by one timeline: position is read from the player, clip boundaries are checked on every tick, and playback state is made honest per source: the button never says “paused” while the player is actually stopped. For Rank Clip, the preview shows the full sequence as one chain with fixed numbers and labels that appear while the clip runs, using a ref so the interval does not read stale state. The spoiler hook is played exactly like the render: the hook phase first, then a jump to the real clip, with a phase indicator. Analyses that have already run are stored locally and can be reused, and user settings (duration, spoiler, ranking layout) survive across sessions without breaking the card when the data is corrupted.

Security is treated as part of the design: media paths are confined to allowed directories, download URLs are validated, the delete endpoint rejects cross-origin requests, mass-delete needs explicit confirmation, and security headers are installed through a pure ASGI middleware because BaseHTTPMiddleware interferes with streaming responses. The whole interface is available in two languages with a key count kept in balance.

Honest note: this project has no automated test suite. Verification happens on real output: duration through ffprobe, content matching through frame-by-frame pixel comparison, and build/type checks, because the most expensive bugs here are visual, not logical. The backend came to 29 Python files and 11,526 lines across 43 endpoints in 6 routers; the frontend is 22 TypeScript files and 16,956 lines; the work spans 178 commits from June to October 2026.

Contact

Interested in working together?

Tell me what you are building and what you need. A short note is enough.

Back to top