autoshorts:AI 辅助选段的长视频转短视频工具
divyaprakash0426/autoshorts
开源项目 autoshorts 可将长视频自动剪辑为短视频,支持 AI 选段、GPU 渲染、样式字幕与可选配音。它提供 15 种内容预设,分析可选 Gemini(含全片深度分析)、OpenAI vision 或本地启发式,转写用 Whisper,配音用本地 Qwen3-TTS,渲染依赖 CUDA 与 NVENC。
Turn long-form videos into short clips with AI-assisted moment selection, GPU rendering, styled captions, and optional voiceovers.
Showcase
Four clips generated from gameplay footage:
| Clip 1 | Clip 2 | Clip 3 | Clip 4 |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
What it does
- Content-aware clipping: 15 presets with their own moment categories, analysis prompts, caption styles, and voice presets. Gaming/esports use action heuristics plus AI ranking; other types use AI-first selection.
- Flexible analysis: Gemini, including full-video deep analysis; OpenAI vision; or local heuristic selection without API analysis.
- Captions and narration: Whisper transcription, AI-written captions, PyCaps styling with FFmpeg fallback, and cross-clip story narration.
- Optional voiceovers: Local Qwen3-TTS with multilingual voice design, adjustable source/voice volumes, and subtitle timing matched to speech.
- GPU rendering: CUDA decoding and analysis, cropping, blurred backgrounds, configurable aspect ratios, and NVENC encoding.
- Dashboard: Choose content and caption styles, manage the video queue, monitor jobs, and browse generated clips.
Supported content: gaming, esports, podcasts, interviews, news/commentary, entertainment, TV shows, comedy, music, vlogs, cooking/DIY, fitness, education, documentaries, and sports.
Examples: English roast / Japanese narration / Chinese news style.
Get started
You need an NVIDIA GPU and driver, a CUDA toolkit with nvcc, FFmpeg with
NVENC support, and Python 3.10+. For voiceovers, 6 GB+ VRAM and 16 GB system RAM
are recommended.
git clone https://github.com/divyaprakash0426/autoshorts.git cd autoshorts make install cp .env.example .env
The Makefile creates a single .venv with the Python dependencies and
CUDA-enabled Decord. Decord's build requires FFmpeg 4.x libraries; see
environment.yml. PyTorch 2.10 pairs with TorchCodec 0.10.0.
An interactive installer and Docker setup are also
provided; Docker requires the NVIDIA Container Toolkit.
Edit .env before running: choose a content type and AI provider, add the
corresponding API key, and set DEBUG_SKIP_ANALYSIS=false and
DEBUG_SKIP_RENDER=false for normal processing.
Dashboard or CLI
# Dashboard: configure settings, add videos, and start processing .venv/bin/python -m streamlit run src/dashboard/About.py # CLI: read videos from gameplay/ and write clips to generated/ .venv/bin/python run.py
Use the dashboard's file picker or place source videos in gameplay/.
Output clips are saved in generated/.
Configuration
Settings live in .env and can also be changed through the dashboard.
| Setting | Purpose |
|---|---|
AI_PROVIDER |
gemini, openai, or local |
VIDEO_TYPE |
Content preset, such as gaming, podcasts, or educational |
ENABLE_SUBTITLES / SUBTITLE_MODE |
Toggle captions; choose speech, ai_captions, or none |
CAPTION_STYLE |
auto matches the detected moment; explicit styles are content-specific |
ENABLE_TTS / TTS_LANGUAGE |
Toggle voiceovers and select their language |
SCENE_LIMIT |
Maximum clips per source video |
MIN_SHORT_LENGTH / MAX_SHORT_LENGTH |
Clip duration bounds; 0 selects automatic lengths |
TARGET_RATIO_W / TARGET_RATIO_H |
Output aspect ratio, typically 9 / 16 |
See .env.example for all settings and voice design for advanced TTS options.
Privacy and cost: Cloud providers receive video content. Gemini deep analysis
uploads the full source video; API usage may incur charges. local uses heuristic
selection instead, but GPU rendering still requires NVIDIA hardware.
Development
# Lightweight suite; real GPU/model checks are skipped .venv/bin/python -m pytest tests/ -q # Include actual CUDA decoding, rendering, and local model inference .venv/bin/python -m pytest tests/ -q --run-gpu --run-models
See Contributing for test prerequisites and bounded footage checks, pipeline flow for architecture, and Roadmap for planned features.
License and credits
Apache 2.0; see NOTICE. Dependencies and model weights retain their own licenses.
Built on work from shorts-maker-gpu and Auto-YouTube-Shorts-Maker.
Support the project -- donations go to charity.
来源:GitHub · github.com



