The Problem
Content creators often spend hours manually sifting through long videos to find highlights. The process requires downloading, transcribing, analyzing, and cutting video segments—tasks that are repetitive and error‑prone. A unified system that automates download, AI‑based highlight detection, and clip generation would save time and reduce manual effort.
What This Does
AutoClip automates the entire highlight‑generation workflow.
- The FastAPI backend (
backend/main.py) exposes REST endpoints (seebackend/api/v1/*.py) for downloading videos from YouTube and B站, triggering AI analysis, and retrieving processed clips. - The processing pipeline is split into five stages (
backend/pipeline/step1_outline.py→step5_clustering.py), each wrapped bybackend/services/processing_service.pyand orchestrated bybackend/services/processing_orchestrator.py. - Asynchronous jobs are dispatched through Celery (
backend/cli.py,backend/desktop_main.py), with progress pushed via WebSocket (backend/api/v1/websocket.py). - The React frontend (
frontend/src/App.tsx) consumes these APIs, shows real‑time progress, and lets users arrange or edit generated clips.
How It Is Wired
| Responsibility | File | Key Functions | External Interaction |
|---|---|---|---|
| Application bootstrap | backend/main.py | create_app() | Instantiates FastAPI, calls app_factory. |
| Router registration | backend/app_factory.py | register_routes() | Imports backend/api/v1/*.py and mounts them. |
| API endpoints | backend/api/v1/processing.py | process_video() | Calls backend/services/processing_service.process(). |
| Task orchestration | backend/services/processing_orchestrator.py | run_pipeline() | Invokes step1_outline → step5_clustering. |
| Database access | backend/repositories/*.py | Repository.get_by_id() | Uses backend/core/database.py (SQLite by default). |
| Celery worker | backend/cli.py | start_celery() | Spins up worker, listens to Redis. |
| WebSocket | backend/api/v1/websocket.py | connect() | Streams progress events to clients. |
| Frontend | frontend/src/App.tsx | useEffect hooks | Calls /api/v1/processing/, subscribes to /ws. |
Execution starts at backend/main.py. A GET to /api/v1/processing/ triggers process_video(), which hands the job to Celery. The worker calls processing_service.process(), which delegates to processing_orchestrator.run_pipeline(). Each step writes temporary files to backend/core/unified_storage.py, updates the SQLite database via the repositories, and emits progress through the WebSocket. The React app displays progress, then lists the generated clips for user interaction.
The module graph has a single hub in backend/app_factory.py; changing any router requires updating this file. No circular imports exist, but the orchestrator’s tight coupling to the step modules means altering a step requires updating the orchestrator.
How To Use It
# 1. Clone
git clone https://github.com/moses-y/autoclip
cd autoclip
# 2. Build Docker images (recommended)
docker build -t autoclip:latest -f Dockerfile .
# 3. Start services
docker-compose up -d # spins up FastAPI, Redis, Celery
# 4. Verify backend
curl http://localhost:8000/docs # OpenAPI UI
# 5. Run frontend
cd frontend && npm ci && npm run dev
Configuration
- Environment variables are read from
backend/.env(seebackend/core/config.py). - Redis URL, database path, and AI provider keys must be set.
- The default AI provider is 通义千问; swap to another by editing
backend/core/llm_manager.py.
Running the CLI
# Trigger a manual pipeline via CLI
python backend/cli.py process https://www.youtube.com/watch?v=XXXX
Real-World Use
A marketing team uploads a 2‑hour interview. They hit “Generate Highlights” on the web UI. The backend downloads the video, runs the AI pipeline (outline → timeline → scoring → title → clustering → video), and streams progress to the client. Once done, the UI presents a drag‑and‑drop list of 8‑second clips for quick social‑media publishing.
Code Health & Issues
- Tests: 16 test files under
backend/tests/andfrontend/tests/. - CI:
/.github/workflows/ci.ymlruns linting, unit tests, and builds Docker images. - License: MIT (LICENSE).
- Documentation: 53 markdown files, including
README.mdandSTARTUP_GUIDE.md. - Observations
- Low: No missing
__init__files. - Low: All database accesses go through repository classes.
- Medium: The orchestrator tightly couples to step modules; refactoring steps requires touching
processing_orchestrator.py. - Low: No obvious secrets committed.
The Bottom Line
AutoClip delivers a complete, Docker‑ready pipeline for AI‑driven video highlight extraction. Its modular design—FastAPI + Celery + React—makes it easy to extend or replace individual components. The tight coupling in the orchestrator is the main architectural cost but does not impede day‑to‑day usage. The project is suitable for teams that need rapid video content creation without building the infrastructure from scratch.