Skip to content

About

LazyClipper turns a long-form YouTube video into timestamped clip candidates and captioned vertical clips. Paste a video URL, let the app find moments worth keeping, then render only the clips you choose.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

LazyClipper

LazyClipper turns long-form YouTube videos into timestamped moment suggestions and captioned vertical clips. Paste a video URL, review the transcript and AI-ranked moments, then render only the clips you choose.

The original video plays through YouTube. Generated clips can be previewed and downloaded from the workspace; saved projects can be reopened without rerunning processing.

Screenshots

Processed project with suggested moments, transcript, and a generated clip

Project creation and project header

Suggested moments and timestamped transcript

Features

  • Create reusable projects from YouTube URLs.
  • Review timestamped transcripts and ranked moment suggestions.
  • Jump to a moment in the original video before creating a clip.
  • Render selected moments as center-cropped 1080×1920 MP4s with burned-in word captions.
  • Preview and download completed clips.
  • Retry failed processing or individual clips, adjust clip ranges, and delete terminal projects while retaining other completed work.

Requirements

  • Docker with BuildKit and Docker Compose v2, using Linux containers.
  • Git and Python 3 for the database-secret setup script.
  • Tailscale access on the server and client for the default private deployment.
  • A reachable OpenAI-compatible LLM provider/gateway, API key, and model.
  • A YouTube URL accessible from the server.

Compose provides PostgreSQL, FFmpeg, Node.js, and the transcription dependencies. The first build downloads large dependencies; the first transcription downloads the configured Whisper model. Allow disk space for images, models, and project media.

Quick Start — Docker

Run these commands from the repository root after cloning:

git clone https://github.com/DrunkTrader/lazy_clipper.git
cd lazy_clipper
test -f .env || cp .env.example .env
python3 scripts/setup_secrets.py
tailscale ip -4

Edit .env: set FRONTEND_BIND_ADDRESS to the server's Tailscale IPv4 address and supply LLM_BASE_URL, LLM_API_KEY, and LLM_MODEL. Leave VITE_API_BASE_URL empty for Compose.

For an existing database, follow the database upgrade guide before starting the API.

docker compose up -d --build --wait
docker compose ps

Open http://<FRONTEND_BIND_ADDRESS>:5173, paste a YouTube URL, and click Create project. After analysis, use Jump to moment, Create Clip, Preview, and Download.

Verify liveness and readiness using the same address:

curl --fail http://<FRONTEND_BIND_ADDRESS>:5173/health
curl --fail http://<FRONTEND_BIND_ADDRESS>:5173/ready

Only the frontend is published; the API and PostgreSQL stay internal to Compose. See Deployment for the private-network access boundary.

Configuration

Use .env.example for the complete configuration reference.

Variable Purpose
FRONTEND_BIND_ADDRESS Server's trusted Tailscale IPv4 address; required by Compose
LLM_BASE_URL OpenAI-compatible API base URL
LLM_API_KEY Provider/gateway credential
LLM_MODEL Model identifier offered by the provider
VITE_API_BASE_URL Empty for Compose; set only for a separate API origin
WHISPER_MODEL / WHISPER_DEVICE Transcription model/device; defaults are small / cpu
MEDIA_TIMEOUT_MARGIN_SECONDS FFmpeg safety margin inside the configured ingestion/clip budgets

The LLM URL, key, and model must be valid, non-placeholder settings. Startup checks configuration without contacting the provider. For a gateway such as FreeLLMAPI running on the Docker host, use http://host.docker.internal:3001/v1; for local development, use its locally reachable address.

For videos requiring authentication, place an exported Netscape-format cookie file at cookies.txt before startup. Compose mounts it read-only at /app/cookies.txt; an absent file is ignored. Cookies are authentication material: never commit them, put their contents in .env, copy them into images, or log them. See Troubleshooting for cookie and yt-dlp checks.

Database

LazyClipper uses PostgreSQL for project metadata; media files live under storage/projects/. A fresh Compose volume initializes the database role automatically, and the API initializes a fresh schema. Database secrets are generated by scripts/setup_secrets.py without printing or overwriting existing credentials.

Inspect the schema revision:

docker compose exec api python -m backend.app.migrations status

Startup refuses outdated or incompatible existing schemas. Upgrades use python -m backend.app.migrations upgrade with the API stopped and the table owner's credentials. Follow Database maintenance for the Compose command, role/password changes, coordinated backups, restore testing, and rollback.

Local Development

Requires Linux, Python 3.12+, PostgreSQL, Node.js 22+ with npm, and FFmpeg/ffprobe with libass subtitle support.

Backend

From the repository root:

python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e '.[transcription,test]' ruff
test -f .env || cp .env.example .env

Provision a local PostgreSQL database and role, then set DATABASE_URL to that reachable database in .env. Supply the password through the URL or DATABASE_PASSWORD_FILE, and configure the LLM settings. For a gateway on the same machine, use http://127.0.0.1:3001/v1. Compose's PostgreSQL port is not published for this workflow.

uvicorn backend.app.main:app --reload

The API runs at http://localhost:8000. For tests without real transcription, install '.[test]' instead of '.[transcription,test]'.

Frontend

In a second shell:

cd frontend
npm ci
npm run dev

Open the URL printed by Vite (normally http://localhost:5173). Leave VITE_API_BASE_URL unset for the local API default, http://localhost:8000; set it in Vite's environment for a different API origin. Local origins are controlled by CORS_ALLOWED_ORIGINS. For local cookies, set YTDLP_COOKIE_FILE=./cookies.txt in the backend environment.

Docker Operations

Run from the repository root:

docker compose up -d --wait                  # Start existing images
docker compose stop                         # Stop containers
docker compose up -d --build --wait          # Rebuild and start after changes
docker compose logs --tail=100 api frontend  # Application logs
docker compose ps                           # Service status

Run one API process per database/storage directory. For interrupted work, explicitly resubmit ingestion or use Retry Clip; reloading a project never starts processing. See Troubleshooting for failures and Deployment for runtime limits and build details.

Reset / Remove

Stop and remove containers while preserving database/model volumes and generated media:

docker compose down

Destructive: the following commands permanently delete local data. Back up the database and media together before using them.

Remove Docker volumes, including the database and Whisper cache (keeps storage/):

docker compose down --volumes

Remove generated project files only (leaves database references to those files):

docker compose down
rm -rf storage/projects

Complete local reset, including data, local dependencies/builds, .env, database secrets, and optional cookies. This retains the checked-out source; repeat the quick start afterward:

docker compose down --volumes
rm -rf storage/projects .venv frontend/node_modules frontend/dist
rm -rf .env .secrets cookies.txt

For coordinated deletion of one terminal project, use the project DELETE endpoint rather than deleting its files manually.

Tests / Verification

Backend, from the repository root with the local test dependencies installed:

. .venv/bin/activate
python -m compileall -q backend
ruff check backend
pytest -q

Frontend, from frontend/:

npm test
npm run build

Basic Docker verification, from the repository root:

docker compose config --quiet
docker compose ps
docker compose exec api python -m pip check

Use the quick-start /health and /ready checks to verify the proxy. Tests mock external services; the real MP4 smoke test runs when FFmpeg and ffprobe are available. See Troubleshooting for real-provider verification.

API

FastAPI documentation is available at http://<FRONTEND_BIND_ADDRESS>:5173/docs in Compose or http://localhost:8000/docs locally.

Endpoint Purpose
POST /api/v1/ingest Create, reuse, or explicitly retry a project
GET /api/v1/projects List saved projects
GET /api/v1/projects/{id}/status Read processing status
GET /api/v1/projects/{id}/transcript / moments Read saved analysis
GET / POST /api/v1/projects/{id}/clips List or render clips
GET /api/v1/processing Read processing capacity
DELETE /api/v1/projects/{id} Delete a terminal project and its media

See API usage for request examples, pagination, media downloads, and error-contract references.

Project Structure

backend/app/       FastAPI API, analysis, services, and migrations
backend/tests/     Backend tests
frontend/src/      React workspace
frontend/tests/    Frontend tests
scripts/           Database role and secret setup
docs/              Operational guides and API usage
assets/            Screenshots
storage/projects/  Generated media and transcripts (Git-ignored)

Documentation

  • Architecture: data flow, processing, persistence, captions, and implementation boundaries.
  • Database: role/password changes, migrations, backup/restore, and rollback.
  • Deployment: private-network setup, configuration policies, and image builds.
  • Troubleshooting: startup, YouTube access, processing failures, and runtime verification.
  • API usage: practical requests and client behavior.

License

No license file or license declaration is currently included in the repository.

About

LazyClipper turns a long-form YouTube video into timestamped clip candidates and captioned vertical clips. Paste a video URL, let the app find moments worth keeping, then render only the clips you choose.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages