Self-hosted YouTube clip creator
Project description
ytclip
Self-hosted YouTube clip creator. Paste a URL, drag in/out points, download the clip at source quality.
No cloud. No subscription. Runs on your machine.
Features
Core
- Embedded YouTube player with draggable in/out timeline handles
- Highest quality by default — merges best video + audio streams
- Smart bandwidth — fetches only the DASH segments covering your clip range; falls back to full download
- No re-encoding option — MKV stream-copy preserves the original codec with zero quality loss
- Audio-only export — MP3 or AAC
- Real-time progress — live ffmpeg output via Server-Sent Events
- Job queue — parallel clip jobs, configurable concurrency, persisted in SQLite
- Clip library — browse, download, and delete clips from the web UI
- CLI —
ytclip clip <url> <start> <end>for scripting and headless use - No Node.js required — single Python process, no build step
- Auto-updates yt-dlp — daily by default, keeps extraction working
- Optional password auth — for non-localhost deployments
Creator Tools
- Clip Queue / Batch Export — queue multiple segments, export all at once; each runs as an independent job with live progress
- Subtitle burn-in — download and burn English subtitles directly into the video with full style control (font size, color, background, position)
- Crop — crop to 9:16 for Reels/Shorts, 1:1 for feed, 4:5 for portrait, or draw a custom region; output resolution shown live
- Speed control — 0.25× to 2× with pitch-corrected audio
- Watermark — stamp a text handle or upload a logo PNG; four corner positions; the app remembers your last 5 watermarks
- GIF & WebP export — palette-optimised animated GIF; WebP for Discord, Notion, and modern embeds
- Clip presets — save any form configuration as a named preset, load with one click; stored server-side in SQLite
- Shareable clip links — every completed clip gets a public
/share/{id}page with an embedded player and social share buttons (Twitter/X, WhatsApp, Facebook, Copy Link) - Brand Kits — save named brand profiles (logo, watermark position, subtitle style, default format); apply all settings at once from the editor
- Direct platform publishing — publish clips to YouTube Shorts, Instagram Reels, TikTok, and LinkedIn without downloading and re-uploading
Quick Start
Docker (recommended)
The pre-built image is on Docker Hub — no clone needed.
One-liner:
docker run -d -p 8000:8000 -v ./clips:/clips --restart unless-stopped zeeshanjan/ytclip:latest
docker-compose (recommended for persistent config):
curl -O https://raw.githubusercontent.com/ZeeshanJan/ytclip/main/docker-compose.yml
docker compose up -d
Or clone the repo if you want to customise the compose file:
git clone https://github.com/ZeeshanJan/ytclip.git
cd ytclip
docker compose up -d
Open http://localhost:8000. Clips are saved to ./clips/.
Docker Hub: hub.docker.com/r/zeeshanjan/ytclip
Bare Python (Python 3.12+ required)
Requires ffmpeg on your PATH (or omit it — a static build is bundled as fallback).
pip install ytclip-app
ytclip serve
Or from source:
git clone https://github.com/ZeeshanJan/ytclip.git
cd ytclip
pip install .
ytclip serve
Open http://localhost:8000.
Configuration
cp config.example.toml config.toml
ytclip looks for a config file in this order:
YTCLIP_CONFIG_FILEenvironment variable/config/config.toml(Docker volume path)~/.ytclip/config.toml./config.toml(current directory)
Key options:
# Public base URL — required for OAuth redirect URIs when using platform publishing
public_url = "http://localhost:8000"
[general]
output_dir = "~/yt-clips" # where clips are saved
max_concurrent_jobs = 2 # parallel download jobs
max_clip_duration = 0 # 0 = no limit (seconds)
[quality]
max_quality = "best" # "best" | "2160p" | "1080p" | "720p" | "480p"
prefer_segments_only = false # true = never download full stream (faster, may fail on some videos)
[output]
filename_template = "{title}_{start}-{end}_{id}"
default_format = "mp4" # "mp4" | "mkv" | "mp3" | "aac"
include_subtitles = false
[auth]
enabled = false
password = "" # set a password when enabled = true
[ytdlp]
auto_update = true
auto_update_interval_hours = 24
cookies_file = "" # path to Netscape cookies file (see Age-Restricted Videos)
# ── Platform Publishing (optional) ───────────────────────────────────────────
# Add credentials for each platform you want to publish to.
# Connect accounts in the app at Settings → Platform Connections.
[platforms.youtube]
client_id = ""
client_secret = ""
[platforms.instagram]
client_id = ""
client_secret = ""
[platforms.tiktok]
client_id = ""
client_secret = ""
[platforms.linkedin]
client_id = ""
client_secret = ""
See config.example.toml for the full reference with comments.
Output Formats
| Format | Codec | Notes |
|---|---|---|
mp4 |
H.264 + AAC | Universal compatibility; VP9/AV1 sources are re-encoded |
mkv |
Source codec | Stream-copy — zero re-encoding, preserves original quality |
mp3 |
MP3 | Audio only |
aac |
AAC | Audio only; stream-copied from AAC source |
CLI Usage
# Start the web server
ytclip serve
ytclip serve --host 0.0.0.0 --port 8080
# Create a clip directly (no server needed)
ytclip clip "https://youtube.com/watch?v=..." --end 1:30
ytclip clip "https://youtube.com/watch?v=..." --start 0:30 --end 2:00 --format mkv
ytclip clip "https://youtube.com/watch?v=..." --start 60 --end 90 --format mp3
# Delegate to a running server instead of running locally
ytclip clip "https://..." --start 0:30 --end 1:00 --server-url http://localhost:8000
# List saved clips
ytclip library
# Show versions
ytclip version
Platform Publishing
Publish clips directly to YouTube Shorts, Instagram Reels, TikTok, and LinkedIn — no downloading and re-uploading.
Setup overview
- Set
public_urlto your ytclip instance's public address inconfig.toml - Create a developer app on each platform (see below) and add the credentials
- Restart ytclip, open Settings → Platform Connections, and click Connect for each platform
- After a clip completes, click the platform icon buttons on the job card to publish
YouTube Shorts
- Open Google Cloud Console → create a project
- Enable YouTube Data API v3 (APIs & Services → Library)
- Create OAuth 2.0 credentials (APIs & Services → Credentials → OAuth client ID → Web application)
- Add
{public_url}/publish/callback/youtubeas an Authorized redirect URI - Copy Client ID and Client secret to
[platforms.youtube]in config.toml
Instagram Reels
- Open Meta for Developers → Create App → Business type
- Add the Instagram Graph API product
- Under App Settings → Basic, add
{public_url}/publish/callback/instagramto Valid OAuth Redirect URIs - Requires an Instagram Business or Creator account linked to a Facebook Page
- Copy App ID →
client_idand App Secret →client_secret
TikTok
- Register at TikTok for Developers → My Apps → Create app
- Request scopes:
user.info.basic,video.publish,video.upload - Add
{public_url}/publish/callback/tiktokas a redirect URI - Copy Client Key →
client_idand Client Secret →client_secret
- Open LinkedIn Developer Portal → Create App
- Enable the Share on LinkedIn product
- Under Auth → Authorized redirect URLs, add
{public_url}/publish/callback/linkedin - Copy Client ID and Client Secret
Note: TikTok does not return a direct post URL after publishing — the button links to your TikTok profile instead.
Brand Kits
Brand kits save a complete set of branding settings — logo, watermark position, subtitle style, and default format — under a single name. Apply a kit in the editor with one click.
Create a kit: Settings → Brand Kits → New Brand Kit
Apply a kit: In the clip editor, use the Brand Kit dropdown at the top of the controls panel. All settings update instantly — watermark, subtitle style, and output format.
Kits are stored in SQLite alongside presets. The logo file is stored in ~/.ytclip/brand_logos/.
Age-Restricted Videos
Export your YouTube cookies from your browser (the account that has access):
# Using a browser extension like "Get cookies.txt LOCALLY" → save as youtube-cookies.txt
# Or via yt-dlp directly:
yt-dlp --cookies-from-browser chrome --cookies youtube-cookies.txt --skip-download "https://youtube.com"
Then point ytclip to the file:
[ytdlp]
cookies_file = "/path/to/youtube-cookies.txt"
Self-Hosting Beyond Localhost
Enable password auth before exposing ytclip to a network:
[auth]
enabled = true
password = "your-strong-password"
Running behind a reverse proxy is recommended for HTTPS. Example Caddy config:
ytclip.yourdomain.com {
reverse_proxy localhost:8000
}
Example nginx config:
server {
listen 443 ssl;
server_name ytclip.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# Required for SSE progress streaming
proxy_buffering off;
proxy_cache off;
}
}
Development
git clone https://github.com/ZeeshanJan/ytclip.git
cd ytclip
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# Unit tests (no network required)
pytest
# Integration tests (downloads a real video — requires network + ffmpeg)
pytest -m integration
# Dev server with auto-reload
uvicorn ytclip.web.app:create_app --factory --host 127.0.0.1 --port 8765 --reload
Stack: Python 3.12 · FastAPI · Jinja2 + HTMX · SQLite (aiosqlite) · yt-dlp · ffmpeg · DaisyUI
Tech Stack
| Layer | Choice | Reason |
|---|---|---|
| Language | Python 3.12+ | yt-dlp native, ffmpeg ecosystem |
| Web framework | FastAPI | Async, handles concurrent clip jobs |
| UI | Jinja2 + HTMX | No Node.js, no build step |
| Progress | Server-Sent Events | One-way push from ffmpeg → browser |
| Config | TOML | Clean syntax, stdlib tomllib in 3.12 |
| Database | SQLite | Zero-config, single-user appropriate |
| yt-dlp | Python library | Programmatic format selection, progress hooks |
| ffmpeg | System + static-ffmpeg fallback |
No manual install friction |
Contributing
Issues and pull requests are welcome.
- Bug reports — open an issue with steps to reproduce and the output of
ytclip version - Feature requests — open an issue describing the use case before implementing
- Pull requests — keep them focused; one feature or fix per PR; include tests where applicable
Support
If ytclip saves you time and you'd like to support ongoing maintenance, you can:
- ⭐ Star this repository — it helps others find the project
- 🐛 Report bugs and suggest improvements — open an issue
- 📣 Share the project — tell others who might find it useful
- ☕ Buy me a coffee — buymeacoffee.com/zeeshan
Support is completely optional. ytclip will always be free and open source.
Legal Disclaimer
This tool is for personal use only. You are solely responsible for ensuring that any content you download or clip complies with YouTube's Terms of Service, applicable copyright law, and the rights of content owners.
ytclip does not host, store, or redistribute any video content. All clips are saved only to your own machine. The authors accept no liability for how you use this tool.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ytclip_app-1.0.3.tar.gz.
File metadata
- Download URL: ytclip_app-1.0.3.tar.gz
- Upload date:
- Size: 89.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c18f663528a7596eb65176a410abd732bcc303f0d9611c5be467066d99b2a457
|
|
| MD5 |
c22fd79904d265c3036f78b17771ba29
|
|
| BLAKE2b-256 |
863dde4f2eb88763edaafae4ef67bfc2b7b08eac84c3e4629704fa9b078476d9
|
File details
Details for the file ytclip_app-1.0.3-py3-none-any.whl.
File metadata
- Download URL: ytclip_app-1.0.3-py3-none-any.whl
- Upload date:
- Size: 97.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb2146c1510ff28007d0f2bf0445abc5706dcf8f8924caa1d1bfda7f34c05239
|
|
| MD5 |
056d297df52802662390eb96b67798b9
|
|
| BLAKE2b-256 |
6292e80f0a21a56088f32e923fa2c5e967aca89c94da5f4b37de49e4fa04c64a
|