Turn any YouTube video into a vertical 9:16 Short, with face-tracked framing and animated subtitles, in one click.
ClipSync is a full-stack, containerised video clipping tool. Paste a YouTube link, pick a start and end time, and an asynchronous worker downloads the segment, transcribes it, detects the speaker's face and renders a ready-to-post vertical clip.
Video.demo.clipsync.mp4
- π YouTube in, Short out: paste a link and a time range (
MM:SSorHH:MM:SS). Only that segment is downloaded. - π± Vertical 9:16 output: 1080 Γ 1920 MP4 (H.264 + AAC), ready for YouTube Shorts, TikTok or Reels.
- π Face-tracked framing: a neural face detector finds the speaker and builds a close-up "facecam" panel.
- π¬ Animated subtitles: word-level transcription burned into the video in short, punchy 2-word chunks with a pop-in animation.
- β‘ Asynchronous processing: jobs are queued in Redis and processed by a background worker, so the API responds instantly.
- π¦ Object storage: finished clips are stored in MinIO (S3-compatible), downloaded through a presigned URL and deleted automatically after 7 days (
CLIP_RETENTION_DAYS). - π³ One-command setup: the whole stack runs with Docker Compose.
Each job goes through this pipeline in the worker:
- Download:
yt-dlpfetches only the requested range (video up to 1440p plus audio), with keyframes forced at the cuts and a near-lossless intermediate encode so the face close-up stays sharp. - Transcribe:
faster-whisper(basemodel, CPU, int8) generates word-level timestamps, which are turned into an animated.asssubtitle file. - Detect the face: OpenCV's DNN module runs a Caffe SSD ResNet-10 face detector (300 Γ 300 input) on sampled frames and keeps the most confident detection. If no face is found, it falls back to the top-left corner, where stream webcams usually sit.
- Render: FFmpeg stacks two panels into a 1080 Γ 1920 frame, a lightly sharpened 1080 Γ 720 face close-up on top and a 1080 Γ 1200 view of the full scene below, and burns in the subtitles.
- Store: the clip is uploaded to MinIO and the job is marked
COMPLETED. The frontend polls the job and shows the download link.
Job states: QUEUED β PROCESSING β COMPLETED / FAILED. If the worker restarts mid-job, the job goes back to the queue. Job state is kept in Redis for 24 hours.
ββββββββββββββ POST /api/clips ββββββββββββββ push job βββββββββββ
β Frontend β ββββββββββββββββββΆ β FastAPI β βββββββββββββΆ β Redis β
β React+Vite β ββββββββββββββββββ β API β βββββ status ββ (queue) β
ββββββββββββββ GET /{job_id} ββββββββββββββ ββββββ¬βββββ
β² (polling) β presigned URL β pop job
β βΌ βΌ
β ββββββββββββββ upload clip ββββββββββββ
βββββββββ download ββββββββ β MinIO β βββββββββββββ β Worker β
β (S3 store) β β yt-dlp Β· β
ββββββββββββββ β Whisper Β·β
β OpenCV Β· β
β FFmpeg β
ββββββββββββ
| Area | Technology |
|---|---|
| API | Python 3.11, FastAPI, Uvicorn, Pydantic |
| Worker | yt-dlp, faster-whisper, OpenCV DNN (Caffe SSD face detector), FFmpeg |
| Queue & state | Redis 7 |
| Storage | MinIO (S3-compatible) via boto3 |
| Frontend | React 18, Vite 5, Tailwind CSS, Lucide React |
| Infrastructure | Docker, Docker Compose, pnpm (Corepack) on Node 20 Alpine |
Interactive docs are available at http://localhost:8000/docs.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/clips |
Queues a new clip. Body: { "video_url", "start_time", "end_time" }. Returns 202 with the job_id, or 422 if the times are invalid or the end is not after the start. |
GET |
/api/clips/{job_id} |
Returns the job status, the error message if it failed and, once completed, a presigned download_url. |
curl -X POST http://localhost:8000/api/clips \
-H "Content-Type: application/json" \
-d '{"video_url": "https://www.youtube.com/watch?v=...", "start_time": "00:05", "end_time": "00:35"}'clipsync/
βββ apps/
β βββ backend/
β β βββ Dockerfile # Python 3.11 + FFmpeg + face detector model
β β βββ requirements.txt
β β βββ tests/test_timecode.py # Run with: python -m tests.test_timecode
β β βββ src/
β β βββ api/
β β β βββ main.py # FastAPI app + CORS
β β β βββ routes/clips.py # POST /api/clips, GET /api/clips/{job_id}
β β βββ core/
β β β βββ config.py # Redis, MinIO and clip retention settings
β β β βββ storage.py # S3 client, bucket setup + presigned URLs
β β β βββ timecode.py # MM:SS / HH:MM:SS parsing and validation
β β βββ services/
β β β βββ video_processor.py # Download β subtitles β face crop β render β upload
β β βββ worker/main.py # Redis job consumer
β βββ frontend/
β βββ src/
β βββ App.jsx # Form, job polling and download
β βββ TimeInput.jsx # MM:SS / HH:MM:SS time input
βββ docker-compose.yaml # api, worker, frontend, redis, minio
Requirements: Docker and Docker Compose.
-
Clone the repository:
git clone https://github.com/franra18/clipsync.git cd clipsync -
Start every service:
docker compose up --build
-
Open the services:
Service URL Frontend http://localhost:5173 API docs (Swagger) http://localhost:8000/docs MinIO console http://localhost:9001 ( admin/password123)MinIO API http://localhost:9000Redis localhost:6379All ports are bound to
127.0.0.1, so the services are only reachable from your own machine.The API reloads on code changes, the worker does not: after editing the pipeline, run
docker compose restart worker. -
Stop the stack:
docker compose down
β οΈ The MinIO credentials indocker-compose.yamlare for local development only. Change them before deploying anywhere public.
Made by Francisco RamΓrez CaΓ±adas