legendaai
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
legendaai
Word-by-word animated captions for Shorts, Reels and TikTok, generated 100% locally.
Local Whisper transcription with word timestamps, smart line breaking and styled ASS karaoke, burned in with ffmpeg. Use it from the CLI or as an MCP server for Claude Code, Codex and Cursor.
Português · Changelog · Contributing
legendaai caption video.mp4 # -> video.captioned.mp4The demo above is a real, unedited run on a synthetic Portuguese clip (an edge-tts voice over an
ffmpeg gradient). The whole job (transcription, layout and burn-in) took 5.8 s on an
RTX 4070 Ti SUPER with large-v3-turbo, and scripts/make-demo.sh
rebuilds it from scratch.
Why
Auto-captions in editing apps are either locked behind a subscription, upload your footage to someone's cloud, or break lines in awkward places. legendaai is a small, scriptable tool that:
Runs offline. It uses faster-whisper (CTranslate2) on CUDA or CPU, and nothing leaves your machine.
Times every word. Each word is highlighted as it is spoken, with a color change, a karaoke fill, or one word at a time with a pop.
Breaks lines like a human editor would. Cues end at pauses and sentence ends, lines are balanced and bottom-heavy, and duration, word and character limits are configurable.
Separates transcription from styling. Transcribe once to an editable
words.json, then re-render any style in milliseconds.Plugs into agents.
legendaai mcpexposes the pipeline as MCP tools, so an agent can say "caption this clip in the karaoke style" and get the file back.
Related MCP server: whisper-mcp
Install
You need Python 3.10+ and ffmpeg built with libass (most package-manager builds qualify; on
macOS use brew install ffmpeg-full, since Homebrew's default ffmpeg bottle lacks it).
# recommended: isolated install from GitHub
pipx install "git+https://github.com/tiagomaker/legendaai"
# with the MCP server
pipx install "legendaai[mcp] @ git+https://github.com/tiagomaker/legendaai"
# or a wheel from the latest release
pip install https://github.com/tiagomaker/legendaai/releases/download/v0.1.0/legendaai-0.1.0-py3-none-any.whlOS | Command |
Ubuntu / Debian / WSL |
|
macOS |
|
Windows |
|
A different binary can be used with LEGENDAAI_FFMPEG=/path/to/ffmpeg (and LEGENDAAI_FFPROBE).
legendaai picks the device automatically (--device auto):
Device | Default model | Compute type |
CUDA |
|
|
CPU |
|
|
faster-whisper needs cuBLAS and cuDNN 9 for CUDA 12. The easiest way to get them is via pip:
pip install nvidia-cublas-cu12 "nvidia-cudnn-cu12==9.*"
export LD_LIBRARY_PATH="$(python -c 'import nvidia.cublas.lib as b, nvidia.cudnn.lib as c; print(b.__path__[0] + ":" + c.__path__[0])')"If CUDA fails to initialise at runtime (missing libraries, out of memory), legendaai logs a
warning and falls back to CPU rather than crashing. Use --device cuda to make that an error
instead. Models are downloaded once from Hugging Face into the usual cache
(~/.cache/huggingface). Pass any faster-whisper model name or a local path with --model.
Usage
# burn captions into a video (the extension picks the container)
legendaai caption clip.mp4 -o clip.final.mp4
# several outputs in one pass: burned video + subtitle files
legendaai caption clip.mp4 -o out.mp4 -o out.srt -o out.vtt -o out.ass
# another preset, forced language, and a single tweak
legendaai caption talk.mov -p karaoke -l en -s font_size=0.08 -s layout.max_lines=1
# fix names and jargon (the terms also bias Whisper as hotwords), and mask profanity
legendaai caption podcast.m4a -o podcast.srt -g glossary.txt --censor
# two-step workflow: transcribe, fix words by hand, then render any style instantly
legendaai transcribe clip.mp4 -o clip.words.json
$EDITOR clip.words.json
legendaai render clip.words.json --video clip.mp4 -o clip.final.mp4 -p popOutput extension | What you get |
| Video with captions burned in (H.264/AAC, or VP9/Opus for WebM). Audio is copied when possible. |
| Styled, animated Advanced SubStation subtitles (load in mpv, VLC, Aegisub or an NLE). |
| Plain cues, compatible with everything. |
| WebVTT with |
| The word-level transcript (the input for |
Run legendaai <command> --help for every option. --json prints a machine-readable summary.
Presets
$ legendaai presets
name aspect highlight description
karaoke 9:16 fill Two-line karaoke: words fill with color as they are spoken
minimal 9:16 none Clean sentence-case captions on a translucent box, no animation
pop 9:16 word One giant word at a time, bouncing in at the center of the screen
shorts 9:16 color Bold uppercase, one short line, active word in yellow with a pop
youtube 16:9 color Landscape 16:9: two balanced lines, subtle active-word highlightPresets are small TOML files. Sizes are fractions of the video height, so a style looks the same
at 720p and at 4K. Copy a built-in preset as a starting point,
edit it, and pass -p my.toml. You can also layer changes with --style-file or -s key=value.
legendaai presets --show shorts prints the fully resolved settings as JSON.
[style]
font = "Montserrat" # any installed font (or use --fonts-dir)
font_size = 0.068 # 6.8% of the video height
primary_color = "#FFFFFF"
highlight_color = "#FFD60A" # #RRGGBB or #RRGGBBAA
outline = 0.0055
alignment = "bottom" # bottom | middle | top
margin_v = 0.30
casing = "upper" # upper | lower | none
highlight = "color" # color | fill | word | none
pop_scale = 1.12
[layout]
max_chars = 16 # per line
max_lines = 2
max_words = 4 # 0 = unlimited
max_duration = 2.2 # seconds per cue
pause_threshold = 0.5 # a silence this long starts a new cueGlossary
Write either plain wrong => right lines or TOML:
# glossary.txt
pai tom => Python
legenda ai => legendaai# glossary.toml
[replace]
"pai tom" = "Python"
"fast a p i" = "FastAPI"The right-hand spellings are also passed to Whisper as hotwords. Matching ignores case and accents, works across word boundaries (multi-word phrases are merged back into single timed words), and keeps surrounding punctuation.
MCP server
legendaai mcp speaks MCP over stdio and exposes four tools:
Tool | What it does |
| Transcribe and write or burn captions in one call |
| Write a word-level JSON transcript |
| Re-render a transcript with any preset (fast, no model) |
| Names, descriptions and settings of the built-in presets |
Claude Code
claude mcp add legendaai -- legendaai mcpCodex (~/.codex/config.toml)
[mcp_servers.legendaai]
command = "legendaai"
args = ["mcp"]Cursor / Claude Desktop / others (mcp.json)
{
"mcpServers": {
"legendaai": { "command": "legendaai", "args": ["mcp"] }
}
}Then just ask: "Add shorts-style captions to ~/Videos/clip.mp4 and give me an .srt too."
How it works
flowchart LR
A[video / audio] -->|faster-whisper<br/>word timestamps| B[Transcript]
B -->|glossary + censor| C[clean Transcript]
C -->|segment: pauses,<br/>sentence ends, limits| D[Cues]
D --> E[ASS writer<br/>karaoke tags]
D --> F[SRT / VTT writers]
E -->|ffmpeg + libass| G[captioned video]Module | Responsibility |
| Device and model selection, faster-whisper decoding, CUDA→CPU fallback, progress |
| Glossary replacement (accent-insensitive, multi-word) and profanity masking |
| Groups words into cues and balances lines; pure functions, no I/O |
| ASS (styles, |
| Probing (rotation, cover art, audio-only), filter escaping, burn command |
| Orchestration shared by the CLI and the MCP server |
| Thin front-ends (Typer + Rich / MCP) |
The core is plain immutable data (Word, Transcript, Cue), so everything except the model
call is unit-tested without a GPU. CI runs ruff, mypy (strict) and pytest on Linux, macOS and
Windows with Python 3.10 to 3.13.
Development
git clone https://github.com/tiagomaker/legendaai && cd legendaai
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev,mcp]"
ruff format --check . && ruff check . && mypy && pytestIntegration tests run the real model on a media file of your choice:
LEGENDAAI_TEST_MEDIA=clip.mp4 pytest -m integration. See CONTRIBUTING.md.
Roadmap
Speaker-aware colors (diarization)
Emoji and keyword emphasis rules (
"money" => 💰)Auto-reframe 16:9 → 9:16 with face tracking
Translation track (
--translate en)PyPI package and a standalone Windows build
Bundled open-licensed fonts
Ideas and PRs are welcome. Open an issue first for anything big.
License
MIT © Tiago Centa. Whisper models are under their own licenses (MIT for OpenAI Whisper).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Transcribe audio and video files to text with timestamps, SRT and VTT. Whisper runs inside.
Transform video, audio and images, and generate media from prompts. FFmpeg, captions, models.
Transcribes audio and video files to text, SRT, VTT and timestamped chunks for RAG.
FFmpeg as a service for AI agents: typed video editing tools, async jobs, downloadable outputs.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables local media processing (video/audio) using FFmpeg and FFprobe, allowing frame extraction, audio conversion, and metadata retrieval through natural language.5MIT
- AlicenseAqualityDmaintenanceEnables MCP clients to transcribe audio/video files locally, generate SRT subtitles, and burn captions into videos via tool calls, without a cloud API.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables agents to inspect local audio files' metadata, convert between common formats, trim segments, and normalize loudness through ffmpeg/ffprobe, plus transcribe audio via a user-configured local transcription command. All processing runs on local binaries, returning real tool output or errors rather than fabricated results.57 npmMIT
- AlicenseAqualityBmaintenanceEnables coding agents to inspect and manipulate video and audio through ffmpeg-backed tools for probing, trimming, cropping, resizing, extracting audio or frames, generating thumbnails, normalizing loudness, concatenating files, burning captions, and converting formats. Each operation returns concise JSON with output path, size, and verified duration or dimensions.1130 npmMIT