[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72274":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":46,"readmeContent":47,"aiSummary":48,"trendingCount":16,"starSnapshotCount":16,"syncStatus":49,"lastSyncTime":50,"discoverSource":51},72274,"AI-Youtube-Shorts-Generator","SamurAIGPT\u002FAI-Youtube-Shorts-Generator","SamurAIGPT","Open-source alternative to Opus Clip, Vidyo.ai, Klap & SubMagic. Turn long-form YouTube videos into viral 9:16 shorts using LLM highlight detection, Whisper transcription, and auto vertical cropping — free, no watermarks, no per-clip credits.","https:\u002F\u002Fwww.vadoo.tv\u002Fai-youtube-shorts-generator",null,"Python",3839,672,42,3,0,36,99,329,108,107.48,false,"main",true,[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],"2short-ai-alternative","ai-clip-generator","ai-clipping","auto-clip","auto-crop","highlight-detection","klap-alternative","llm","open-source","opus-clip-alternative","reels","shorts-maker","submagic-alternative","tiktok","vertical-video","video-editing","vidyo-ai-alternative","viral-clips","whisper","youtube-shorts","2026-06-12 04:01:04","# AI YouTube Shorts Generator\n\n**The open-source alternative to Opus Clip, Vidyo.ai, Klap, SubMagic, 2short.ai, and other AI clipping tools.** Drop in any long-form YouTube video and get back ranked, viral-ready 9:16 shorts — for free, with no per-clip credits, no watermarks, and full control over the highlight algorithm.\n\nBuilt for creators, agencies, and developers who don't want to pay $20–$300\u002Fmonth or be capped on minutes processed. Uses GPT-class LLM highlight detection and Whisper transcription to extract the most viral-worthy moments and auto-crop them vertically for TikTok, Reels, and Shorts.\n\n> **Building your own Opus Clip–style SaaS?** Skip the infra and ship on the same APIs that power this repo:\n> - [AI Clipping API](https:\u002F\u002Fmuapi.ai\u002Fplayground\u002Fai-clipping) — end-to-end clip selection + render\n> - [Auto-Crop API](https:\u002F\u002Fmuapi.ai\u002Fplayground\u002Fautocrop) — vertical reframing only\n\n![longshorts](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F3f5d1abf-bf3b-475f-8abf-5e253003453a)\n\n## Why Use This Instead of Opus Clip \u002F Vidyo.ai \u002F Klap?\n\n| | This repo | Opus Clip \u002F Vidyo.ai \u002F Klap \u002F SubMagic |\n|---|---|---|\n| **Price** | Free + open source (pay only for API usage) | $20–$300\u002Fmonth subscriptions |\n| **Per-clip credits** | None — process unlimited videos | Monthly minute caps, overage fees |\n| **Watermarks** | Never | On free tiers |\n| **Highlight algorithm** | Fully editable virality framework | Black box |\n| **Output format** | Any aspect ratio, any resolution | Locked presets |\n| **Batch processing** | `xargs` an entire URL list | Manual upload one-by-one |\n| **JSON \u002F API output** | Built-in (`--output-json`) | Limited or paid tier only |\n| **Self-hostable** | Yes — runs on your machine or server | SaaS only, your videos sit on their servers |\n| **White-label \u002F embeddable** | Yes — MIT licensed, import as Python lib | No |\n\n## Features\n\n- **🎬 YouTube In, Vertical Out**: Hand it any YouTube URL — get back N viral-ready 9:16 mp4s\n- **🔀 Two Modes — API (fast) or Local (offline)**: Default `--mode api` uses MuAPI for download\u002Ftranscription\u002Fcropping; `--mode local` runs entirely on your machine with `yt-dlp`, `faster-whisper`, and `ffmpeg`\u002F`opencv`, and lets you pick OpenAI or Gemini for highlight ranking\n- **🤖 Virality-Aware Highlight Selection**: Clips ranked on hooks, emotional peaks, opinion bombs, revelation moments, conflict, quotable lines, story peaks, and practical value — not just generic \"interesting\"\n- **📈 Score + Hook + Reason for Every Clip**: Each highlight comes with a viral score, an opening hook line, and a one-sentence explanation of why it works\n- **🎤 Whisper Transcription, Your Choice**: Cloud (`\u002Fopenai-whisper` via MuAPI) or local (`faster-whisper`, CPU or CUDA) — same downstream output shape\n- **🧩 Long-Video Aware**: Videos over 30 minutes are auto-chunked with overlap so nothing gets missed\n- **♻️ Smart Dedupe**: Overlapping highlights are collapsed by score so you never get two near-duplicate clips\n- **🎯 Smart Vertical Crop**: API mode uses MuAPI's auto-crop; local mode runs OpenCV face tracking with motion smoothing\n- **📱 Any Aspect Ratio**: 9:16 for TikTok\u002FReels\u002FShorts, 1:1 for square, anything else by flag\n- **🧰 CLI + Python Library**: Use it from the shell or import `generate_shorts(...)` into your own pipeline\n- **📦 JSON Output**: `--output-json` dumps the full result (transcript + every candidate highlight + final clip URLs\u002Fpaths) for downstream automation\n\n## Quick Start (No Setup)\n\nDon't want to self-host? The [AI Clipping API](https:\u002F\u002Fmuapi.ai\u002Fplayground\u002Fai-clipping) gives you the same Opus Clip–style pipeline as a single HTTP call — no Python, no dependencies, pay-per-clip instead of monthly subscriptions.\n\n---\n\n## Installation (Self-Hosted)\n\n### Prerequisites\n\n- Python 3.10+\n- For **API mode (default)**: a MuAPI key — powers download, transcription, highlight ranking, and clipping in a single dependency\n- For **Local mode** (`--mode local`): `ffmpeg` on your PATH and an LLM API key (`OPENAI_API_KEY` or `GEMINI_API_KEY`; only the LLM step is remote)\n\n### Steps\n\n1. **Clone the repository:**\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002FSamurAIGPT\u002FAI-Youtube-Shorts-Generator.git\n   cd AI-Youtube-Shorts-Generator\n   ```\n\n2. **Create and activate a virtual environment:**\n   ```bash\n   python3.10 -m venv venv\n   source venv\u002Fbin\u002Factivate\n   ```\n\n3. **Install Python dependencies:**\n   ```bash\n   pip install -r requirements.txt\n   # Only if you plan to use --mode local:\n   pip install -r requirements-local.txt\n   ```\n\n4. **Set up environment variables:**\n\n   Create a `.env` file in the project root:\n   ```bash\n   # API mode (default)\n   MUAPI_API_KEY=your_muapi_key_here\n\n   # Local mode (--mode local)\n   LLM_PROVIDER=openai         # openai or gemini\n   OPENAI_API_KEY=your_openai_key_here\n   OPENAI_MODEL=gpt-4o-mini          # optional, default gpt-4o-mini\n   GEMINI_API_KEY=your_gemini_key_here\n   GEMINI_MODEL=gemini-2.5-flash      # optional, default gemini-2.5-flash\n   LOCAL_WHISPER_MODEL=base          # tiny \u002F base \u002F small \u002F medium \u002F large-v3\n   LOCAL_WHISPER_DEVICE=auto         # auto \u002F cpu \u002F cuda\n   LOCAL_OUTPUT_DIR=output           # where local mp4s land\n   ```\n\n## Usage\n\n### Single video (API mode — default)\n\n```bash\npython main.py \"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=VIDEO_ID\"\n```\n\n### Single video (Local mode — runs offline except for the LLM call)\n\n```bash\npython main.py \"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=VIDEO_ID\" --mode local\n```\n\nLocal mode writes the rendered shorts to `.\u002Foutput\u002Fshort_01.mp4`, `short_02.mp4`, … (override with `LOCAL_OUTPUT_DIR`).\n\n### With options\n\n```bash\npython main.py \"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=VIDEO_ID\" \\\n    --mode api \\\n    --num-clips 5 \\\n    --aspect-ratio 9:16 \\\n    --output-json result.json\n```\n\n### Local file or path\n\nIn `--mode local`, you can pass a `file:\u002F\u002F` URL or a direct filesystem path and skip YouTube entirely:\n\n```bash\npython main.py \"\u002FUsers\u002Fyou\u002FVideos\u002Finput.mp4\" --mode local\npython main.py \"file:\u002F\u002F\u002FUsers\u002Fyou\u002FVideos\u002Finput.mp4\" --mode local\n```\n\nThe Python API works the same way:\n\n```python\nfrom shorts_generator import generate_shorts\n\nresult = generate_shorts(\n    \"\u002FUsers\u002Fyou\u002FVideos\u002Finput.mp4\",\n    num_clips=5,\n    aspect_ratio=\"9:16\",\n    mode=\"local\",\n)\nfor short in result[\"shorts\"]:\n    print(short[\"score\"], short[\"title\"], short[\"clip_url\"])\n```\n\nLocal transcription is cached as an `.srt` file in `LOCAL_OUTPUT_DIR` using the\nvideo's base name. If the cache already exists and is newer than the source\nfile, the app reuses it instead of running Whisper again.\n\nLocal downloads are also cached in `LOCAL_OUTPUT_DIR` as\n`source_\u003Cyoutube_id>.mp4` when the input is a YouTube URL. If that file already\nexists, the app skips `yt-dlp` and reuses the cached video.\n\n### Batch processing\n\nCreate a `urls.txt` file with one URL per line, then:\n\n```bash\nxargs -a urls.txt -I{} python main.py \"{}\"\n```\n\n### CLI flags\n\n| Flag | Default | Notes |\n|------|---------|-------|\n| `--mode` | `api` | `api` (MuAPI, fast, no setup) or `local` (remote URL, `file:\u002F\u002F`, or local path + faster-whisper + LLM provider + ffmpeg) |\n| `--num-clips` | `3` | How many shorts to render |\n| `--aspect-ratio` | `9:16` | Any ratio; `9:16` for TikTok\u002FReels, `1:1` for square |\n| `--format` | `720` | Source download resolution: `360` \u002F `480` \u002F `720` \u002F `1080` |\n| `--language` | auto | Force Whisper language code (e.g. `en`) |\n| `--output-json` | — | Dump the full result (transcript + all candidates) to a file |\n\n### API mode vs Local mode\n\n| Step | API mode (`--mode api`) | Local mode (`--mode local`) |\n|---|---|---|\n| Download | MuAPI `\u002Fyoutube-download` | `yt-dlp` for remote URLs, direct file path for local inputs |\n| Transcription | MuAPI `\u002Fopenai-whisper` | `faster-whisper` (CPU or CUDA) |\n| Highlight LLM | MuAPI `gpt-5-mini` | `LLM_PROVIDER=openai` uses OpenAI (`gpt-4o-mini` by default), `LLM_PROVIDER=gemini` uses Gemini (`gemini-2.5-flash` by default) |\n| Vertical crop | MuAPI `\u002Fautocrop` | `ffmpeg` + OpenCV face tracking |\n| Output | hosted URLs | local mp4 paths |\n| Required keys | `MUAPI_API_KEY` | `OPENAI_API_KEY` or `GEMINI_API_KEY` (+ `ffmpeg` on PATH) |\n\n## How It Works\n\n1. **Download**: Fetches the source video from YouTube\n2. **Transcribe**: MuAPI `\u002Fopenai-whisper` produces a timestamped transcript (verbose_json segments)\n3. **Detect content type**: An LLM classifies the video (podcast, interview, tutorial, vlog, etc.) and density, so the prompt can be tuned per content style\n4. **Long-video chunking**: Videos > 30 min are split into 20-min overlapping chunks\n5. **Highlight ranking**: An LLM scans the transcript through a virality framework — hook moments, emotional peaks, opinion bombs, revelations, conflict, quotables, story peaks, practical value — and emits ranked candidates with scores 0–100\n6. **Dedupe**: Overlapping candidates are collapsed by score (>50% overlap → keep the higher score)\n7. **Top-N selection**: The top `--num-clips` candidates are selected\n8. **Auto-crop**: Each highlight is rendered as a vertical short at the requested aspect ratio\n\n**Output**: a list of mp4 URLs plus, for each clip, its title, viral score, hook sentence, and a one-line reason explaining why it should perform.\n\n## Output\n\nConsole output looks like:\n\n```\n========================================================================\nHighlights:    7 candidates → kept top 3\n========================================================================\n\n#1  score=92  124.3s → 187.6s\n     title:  The one mistake that cost me $50K\n     hook:   \"Nobody talks about this, but it killed my first startup...\"\n     clip:   https:\u002F\u002F...\u002Fshort_1.mp4\n\n#2  score=88  ...\n```\n\n`--output-json result.json` produces:\n\n```json\n{\n  \"source_video_url\": \"...\",\n  \"transcript\": { \"duration\": 1873.4, \"segments\": [...] },\n  \"highlights\": [ {...}, {...}, ... ],\n  \"shorts\": [\n    {\n      \"title\": \"...\",\n      \"start_time\": 124.3,\n      \"end_time\": 187.6,\n      \"score\": 92,\n      \"hook_sentence\": \"...\",\n      \"virality_reason\": \"...\",\n      \"clip_url\": \"https:\u002F\u002F...\u002Fshort_1.mp4\"\n    }\n  ]\n}\n```\n\n## Configuration\n\n### Highlight selection criteria\nEdit `shorts_generator\u002Fhighlights.py`:\n- **Virality framework**: `VIRALITY_CRITERIA` — the ranked list of signals the LLM optimizes for\n- **System prompt**: `HIGHLIGHT_SYSTEM_PROMPT` — duration sweet spot, hook rules, JSON schema\n- **Chunk size**: `CHUNK_SIZE_SECONDS` (default 1200) — chunk length for long videos\n- **Long-video threshold**: `LONG_VIDEO_THRESHOLD` (default 1800) — videos longer than this are chunked\n- **Chunk overlap**: `CHUNK_OVERLAP_SECONDS` (default 60) — overlap between chunks so cross-boundary clips aren't missed\n\n### Polling \u002F timeout\nEdit `shorts_generator\u002Fconfig.py` (or set env vars):\n- `MUAPI_POLL_INTERVAL` (default 5s) — seconds between job-status polls\n- `MUAPI_POLL_TIMEOUT` (default 1800s) — give up after this long\n\n### Whisper transcription\nAudio is transcribed by MuAPI's `\u002Fopenai-whisper` endpoint (server-side `whisper-1`). Pass `--language \u003Ccode>` to lock the recognition to a specific language; otherwise it auto-detects.\n\n## Project Structure\n\n```\nAI-Youtube-Shorts-Generator\u002F\n├── main.py                       CLI entry point\n├── requirements.txt              core deps (api mode)\n├── requirements-local.txt        optional deps for --mode local\n├── .env.example\n└── shorts_generator\u002F\n    ├── config.py                 env \u002F settings (MuAPI + local LLM + Whisper)\n    ├── muapi.py                  generic submit + poll wrapper\n    ├── downloader.py             API mode: YouTube download via MuAPI\n    ├── transcriber.py            API mode: MuAPI \u002Fopenai-whisper client\n    ├── highlights.py             shared LLM virality ranking (pluggable backend)\n    ├── clipper.py                API mode: MuAPI \u002Fautocrop\n    ├── pipeline.py               mode dispatcher (api ↔ local)\n    └── local\u002F                    --mode local backends (offline)\n        ├── downloader.py         yt-dlp download\n        ├── transcriber.py        faster-whisper transcription\n        ├── llm.py                OpenAI or Gemini client selector\n        └── clipper.py            ffmpeg cut + OpenCV vertical crop\n```\n\n## Troubleshooting\n\n### Whisper produced no segments\nThe video may have no detectable speech, or it may be in a language Whisper struggles with. Try passing `--language en` (or the correct ISO-639-1 code) to skip auto-detection.\n\n### Looking for better results?\nThe [AI Clipping API](https:\u002F\u002Fmuapi.ai\u002Fplayground\u002Fai-clipping) uses an improved algorithm that produces higher-quality clips with better highlight detection.\n\n## Contributing\n\nContributions are welcome! Please fork the repository and submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Related Projects\n\n- [AI Influencer Generator](https:\u002F\u002Fgithub.com\u002FSamurAIGPT\u002FAI-Influencer-Generator)\n- [Text to Video AI](https:\u002F\u002Fgithub.com\u002FSamurAIGPT\u002FText-To-Video-AI)\n- [Faceless Video Generator](https:\u002F\u002Fgithub.com\u002FSamurAIGPT\u002FFaceless-Video-Generator)\n- [AI B-roll Generator](https:\u002F\u002Fgithub.com\u002FAnil-matcha\u002FAI-B-roll)\n- [No-code YouTube Shorts Generator](https:\u002F\u002Fwww.vadoo.tv\u002Fclip-youtube-video)\n","AI YouTube Shorts Generator 是一个开源工具，用于将长视频转换为适合TikTok、Reels等平台的9:16竖屏短视频。它通过使用大型语言模型（LLM）进行高光片段检测和Whisper API进行语音转文字，自动选择最具吸引力的内容并垂直裁剪视频，无需支付每片段费用或添加水印。此项目特别适合内容创作者、代理机构及开发者在不希望每月支付高额订阅费的情况下制作高质量短视频。此外，它还支持批量处理和本地运行模式，提供灵活的API接口供二次开发使用。",2,"2026-06-11 03:41:09","high_star"]