Skip to content

anilcse/ClipCraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clipcraft

Clipcraft is a video clipping backend built with FastAPI and FFmpeg. Give it a video URL and one or more time ranges; it downloads the source once, cuts each range (optionally adding a 2× slow-motion copy), merges everything, and can swap in a background audio track.

Features

  • Download any yt-dlp-supported URL (cached and deduplicated per video).
  • Extract multiple segments (start-end start-end ...) in parallel.
  • Optional 2× slow motion per segment.
  • Optional background-audio replacement (looped to fit).
  • Async task pipeline with progress, cancel, retry, edit, and resume-on-restart.
  • Web UI served at /.

Architecture (py/)

File Responsibility
clipcraft.py FastAPI app and API routes
pipeline.py TaskManager: async orchestration, caching, cancellation, resume
media.py Async ffmpeg / ffprobe / yt-dlp subprocess wrappers
db.py SQLite (WAL) + SQLAlchemy model

Performance design:

  • Every ffmpeg/yt-dlp call runs as an async subprocess — the API never blocks.
  • Each clip is produced in a single encode pass straight from the source (input seeking with -ss/-to, slow-motion filter applied in the same pass).
  • All clips encode concurrently (bounded by CLIPCRAFT_PARALLEL_ENCODES, default 2) with identical codec settings.
  • The final merge is a stream copy (concat demuxer) — zero re-encode.
  • Audio replacement stream-copies the video and loops the audio in one pass.
  • Downloads, clips, and outputs are written atomically and cached, so retries and restarts skip completed work.

Quickstart (Local)

pip install -r requirements.txt   # plus ffmpeg on your PATH
cd py
uvicorn clipcraft:app --port 8000

Open http://localhost:8000.

Docker

docker build -t clipcraft .
docker run -p 8000:8000 clipcraft

About

Crop, edit, and create stunning video clips from YouTube.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors