โ† Open Source
zcbacxc

movie-narrator

๐ŸŽฌ Generate narrated movie recap videos from a single prompt.

ApplicationsContent creationPython
Open on GitHub
Momentum
+22stars in 24 hours+2.5%
895
Stars
160
Forks
+205
This week
2
Contributors
Created 2026-07-11 ยท Updated 2026-10-12 ยท #724 today
Top developers
README

English ็ฎ€ไฝ“ไธญๆ–‡

๐ŸŽฌ Movie Narrator

Python License CI PyPI Downloads

One Prompt โ†’ One Narrated Movie Video

Movie Narrator is an open-source toolkit that automatically generates movie recap videos with narration, subtitles, and rendered output from a simple command.


Features

  • ๐ŸŽฌ LLM-powered movie recap script generation
  • ๐Ÿ”Š Text-to-Speech narration (Edge-TTS by default)
  • ๐Ÿ’ฌ Automatic SRT subtitle generation
  • ๐ŸŒ Multi-language subtitles with LLM translation
  • ๐Ÿ Multi-candidate horse race โ€” run N variations, auto-pick the best
  • ๐ŸŽฏ Reference video imitation โ€” extract style from viral narration
  • ๐Ÿ‘๏ธ VLM scene captioning via cloud VLM API
  • ๐ŸŽญ Narrator perspective (omniscient / character / detective)
  • ๐ŸŽจ Render template system (title cards, watermarks, slogans)
  • ๐Ÿ” TMDB fact verification with source attribution
  • ๐Ÿ–ฅ๏ธ Web UI (separate movie-narrator-web package)
  • ๐ŸŽž๏ธ Video rendering (1080p/4K output)
  • ๐Ÿ“ Script markdown export
  • ๐ŸŽต Background music integration
  • ๐Ÿ”Œ Extensible plugin architecture (custom TTS / LLM backends)
  • โ˜๏ธ Async task processing (submit and go, notified on completion)
  • ๐ŸŒ Remote inference via REST API
  • โœ… Final-video QA โ€” black-frame / slideshow-risk detection
  • ๐Ÿ—ฃ๏ธ Optional Chinese ASR (automatic multi-backend fallback)

Installation

Requirements

  • Python 3.10+

Install Movie Narrator

From PyPI

pip install movie-narrator

From Source

git clone https://github.com/zcbacxc/movie-narrator.git
cd movie-narrator
pip install -e .

Optional extras

# Scene detection (PySceneDetect)
pip install "movie-narrator[media]"

# WhisperX + faster-whisper + FunASR + semantic search (requires PyTorch; Python < 3.14)
pip install "movie-narrator[ml]"

# Web UI (FastAPI + React) โ€” separate package
pip install movie-narrator-web

# Everything
pip install "movie-narrator[full]"

Note on Python 3.14+: The [ml] extra is limited to Python < 3.14 โ€” PyTorch itself is now 3.14-ready (2.10+), but downstream ML dependencies (WhisperX, FunASR) have not yet shipped Python 3.14 wheels; on 3.14+ it is silently skipped and the align/match steps automatically soft-degrade (see Soft steps).

For development:

pip install -e ".[dev]"

Quick Start

Prerequisites

  • LLM: Default uses local Ollama (ollama serve to start). Or configure remote LLM via .env file.

Basic Usage

# Generate a narrated movie video
mn create --movie "้ฃž้ฉฐไบบ็”Ÿ" --style "็ƒญ่ก€ๆž็ฌ‘" --duration 60

# With custom voice and format
mn create --movie "้ฃž้ฉฐไบบ็”Ÿ" --voice "zh-CN-XiaoxiaoNeural" --format "9:16"

More Commands

mn create --config examples/job.example.yaml     # Drive from YAML config
mn create --subtitle-lang en --subtitle-mode bilingual  # Multi-language subtitles
mn race --movie "้ฃž้ฉฐไบบ็”Ÿ" --video movie.mp4 --candidates 3  # Multi-candidate horse race
mn imitate --reference viral_ref.mp4 --movie "้ฃž้ฉฐไบบ็”Ÿ"  # Reference video imitation
mn serve               # Start remote inference API server (v0.6.1+)
mn submit -m    # Submit async task
mn tasks               # List recent tasks
mn version             # Show version
mn --help              # Show full CLI help

All CLI flags and usage examples are documented in examples/cli-usage.sh.


Configuration

All settings use the MN_ prefix to avoid conflicts with other tools.

Via .env file (recommended)

~/.movie-narrator/.env is auto-created with default values on first run โ€” edit it to configure LLM, TTS, and other settings. This file lives outside the package, so pip install/upgrade/uninstall never touches it. You can also create a project-level .env in your working directory for per-project overrides.

MN_LLM_BASE_URL=http://localhost:11434/v1
MN_LLM_API_KEY=ollama
MN_LLM_MODEL=qwen2.5:7b
MN_DEFAULT_VOICE=zh-CN-YunxiNeural

Via environment variables

# PowerShell
$env:MN_LLM_BASE_URL="http://localhost:11434/v1"
$env:MN_LLM_MODEL="qwen2.5:7b"
mn create --movie "้ฃž้ฉฐไบบ็”Ÿ" --duration 60
# Linux / macOS
export MN_LLM_BASE_URL=http://localhost:11434/v1
export MN_LLM_MODEL=qwen2.5:7b
mn create --movie "้ฃž้ฉฐไบบ็”Ÿ" --duration 60

Config lookup order

Priority Location Notes
1 Environment variables (MN_*) Highest
2 cwd/.env Project-level
3 ~/.movie-narrator/.env User-level, never lost on pip install/upgrade/uninstall
4 Built-in defaults Local Ollama

Full reference

See .env.example for the complete list of all environment variables (LLM + TTS infrastructure only). All pipeline behavior is configured via examples/job.example.yaml โ€” params keys covering scene detection, match, render, translate, BGM, WhisperX/FunASR align, async, and video sizes.

LLM Provider Guides

Movie Narrator works with any OpenAI-compatible LLM. New user? Check out the LLM Provider Guides for step-by-step registration and free-tier setup:

Provider Free Tier Best For
Ollama Completely free (local) Privacy, offline use
Zhipu (GLM) glm-4-flash unlimited free Zero-cost, no GPU
Alibaba Bailian 1M tokens per model Qwen flagship models
Xiaomi MiMo Limited-time free + ยฅ10 invite bonus LLM + TTS in one platform
SiliconFlow Free models + voucher credits Multi-model switching

Output

File Description
narration.mp3 AI-generated narration audio
mixed.mp3 Narration + BGM overlay (when BGM enabled; otherwise narration.mp3 used directly)
subtitle.srt Synchronized subtitle file (original narration)
subtitle..srt Translated subtitle (when --subtitle-lang set)
subtitle.bilingual.srt Bilingual subtitle (when --subtitle-lang set)
script.md Human-readable script
research.json Movie research data (when --research)
metadata.json Segment timings, pipeline status, config
final.mp4 Rendered video (16:9 or 9:16)
matches.json Scene-to-segment clip matching (when video provided)
clips/ Per-segment clip .mp4 files (when --no-clips not set)

clips/ holds a standalone clip per segment, ready for secondary editing or reuse.


Pipeline

16-step sequential pipeline (see Architecture):

resolve_video โ†’ prepare_assets โ†’ research_plot โ†’ generate_script โ†’
export_script_md โ†’ generate_voice โ†’ align_audio โ†’ detect_scenes โ†’
match_clips โ†’ mix_bgm โ†’ translate_subtitles โ†’ generate_subtitle โ†’
run_qa_gate โ†’ render_video โ†’ validate_deliverable โ†’ export_clips

Soft steps (research, align, scene detect, scene match, BGM, translate, QA gate, clip export) gracefully skip or soft-degrade when optional dependencies are missing or upstream data is unavailable. Use --strict to abort instead.


Project Structure

For contributors โ€” most users only need mn create. See Architecture for details.

movie-narrator/
โ”œโ”€โ”€ src/movie_narrator/
โ”‚   โ”œโ”€โ”€ cli.py               # Typer CLI entry point
โ”‚   โ”œโ”€โ”€ config.py            # Pydantic settings
โ”‚   โ”œโ”€โ”€ models.py            # Data models (Context, Status, etc.)
โ”‚   โ”œโ”€โ”€ contract.py          # Stable API contract surface
โ”‚   โ”œโ”€โ”€ pipeline/            # 16-step pipeline (runner, steps, errors)
โ”‚   โ”œโ”€โ”€ cloud/               # Task queue, remote inference, batch, scheduling, DLQ, distributed (v0.9.x)
โ”‚   โ”œโ”€โ”€ reliability/         # Circuit breaker + retry policy (v0.9.1)
โ”‚   โ”œโ”€โ”€ workflow/            # YAML job config (schema, loader, merge)
โ”‚   โ”œโ”€โ”€ tts/                 # TTS provider abstraction layer
โ”‚   โ””โ”€โ”€ utils/               # Shared utilities (console, log, font, etc.)
โ”œโ”€โ”€ tests/                   # Unit + integration tests
โ”œโ”€โ”€ docs/                    # Architecture, guides, roadmap
โ”œโ”€โ”€ examples/                # Job YAML, CLI usage, plugins
โ””โ”€โ”€ .github/workflows/       # CI/CD

Documentation


Compliance Notices

  • Edge-TTS: the default TTS channel (edge) is built on a reverse-engineered, unofficial interface. It is provided for personal / non-commercial free testing only. For commercial deployment, switch MN_TTS_PROVIDER to openai or mimo (both built-in).
  • TMDB: movie research data is sourced from TMDB (The Movie Database). When TMDB data is used, the source attribution is recorded in research.json as required, as a courtesy.

License

Licensed under the AGPL-3.0-or-later License.