Metadata-Version: 2.5
Name: miragea-shorts
Version: 0.1.0
Summary: Open-source faceless video maker and MCP server: turn a scene script into a voiced, captioned 9:16 short (MP4 + SRT) for YouTube Shorts, TikTok and Reels. No GPU, no stock-footage key. Voiced by Miragea.
Project-URL: Homepage, https://codeberg.org/miragea-voice/miragea-shorts
Project-URL: Documentation, https://codeberg.org/miragea-voice/miragea-shorts#readme
Project-URL: Issues, https://codeberg.org/miragea-voice/miragea-shorts/issues
Project-URL: Changelog, https://codeberg.org/miragea-voice/miragea-shorts/src/branch/main/CHANGELOG.md
Project-URL: Miragea API, https://miragea.ai
Author: miragea-shorts contributors
License-Expression: MIT
License-File: LICENSE
Keywords: agent-skill,ai-voiceover,captions,claude,cursor,faceless-video,ffmpeg,mcp,mcp-server,miragea,reels,short-video-maker,shorts,subtitles,text-to-speech,text-to-video,tiktok,tts,video-generator,youtube-shorts
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Topic :: Multimedia :: Video
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: anyio>=4
Requires-Dist: httpx>=0.27
Requires-Dist: mcp>=1.9
Requires-Dist: pydantic>=2
Requires-Dist: tomli>=2; python_version < '3.11'
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://codeberg.org/miragea-voice/miragea-shorts/raw/branch/main/docs/images/cover.png" alt="miragea-shorts banner: three vertical video frames with big keywords and yellow word-highlight captions next to the project name" width="860">
</p>

# miragea-shorts

**miragea-shorts is an open-source faceless video maker and MCP server. It turns a short scene script (JSON or Markdown) into a finished vertical video for YouTube Shorts, TikTok and Instagram Reels: AI voiceover from the [Miragea](https://miragea.ai) API, a big on-screen keyword per scene, word-by-word highlighted captions, plus an SRT file and a thumbnail. It runs on a laptop with ffmpeg: no GPU, no stock-footage key, no second LLM key.** Use it from the command line, or let Claude, Cursor, Codex or any MCP client write the script and call it for you.

[![tests](https://img.shields.io/badge/tests-34%20passing-brightgreen)](tests) [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE) [![python](https://img.shields.io/badge/python-3.10%2B-blue)](pyproject.toml)

<p align="center">
  <img src="https://codeberg.org/miragea-voice/miragea-shorts/raw/branch/main/docs/images/demo.gif" alt="Animated preview of a real 16-second short about honey: scene keywords at the top, the spoken word highlighted in yellow in the captions" width="270">
</p>

Full-quality video with sound (16 s, 1080x1920, made by the command in "Quick start"):
[docs/media/honey-short.mp4](https://codeberg.org/miragea-voice/miragea-shorts/raw/branch/main/docs/media/honey-short.mp4).
Speech recognition on the finished audio returns the script word for word, so the voice and captions line up with the text.

## Quick start

```bash
pipx install miragea-shorts          # or: uvx --from miragea-shorts miragea-shorts ...
export MIRAGEA_API_KEY=...           # create a key at https://miragea.ai/workspace/api
miragea-shorts doctor                # checks key, network and ffmpeg (free)
miragea-shorts voices                # your saved voices
miragea-shorts plan examples/honey.json --voice "My Voice"        # validate + estimate credits (free)
miragea-shorts make examples/honey.json --voice "My Voice" -o honey.mp4
```

You get `honey.mp4`, `honey.srt`, `honey.jpg` (thumbnail) and `honey.json` (what was made and what it cost in credits).
Needs Python 3.10+ and ffmpeg with libass (`brew install ffmpeg` / `apt install ffmpeg`).

A script is just scenes:

```json
{"title": "Honey never spoils",
 "scenes": [
  {"id": "hook",  "keyword": "Honey never spoils", "text": "Here is a food that never goes bad. Honey."},
  {"id": "why",   "keyword": "Why?", "text": "It is so dry and so acidic that bacteria simply cannot grow in it."},
  {"id": "cta",   "keyword": "Follow for more", "text": "Follow for one tiny fact every day.", "color": "#0f766e"}
 ]}
```

Markdown works too: every `# Heading` is a scene and doubles as its on-screen keyword; a line like `[laughs]` adds a delivery tag.
Per scene you can also set `image` (a local JPG/PNG with a slow Ken Burns zoom), `color` (`#RRGGBB`) and `tags`.

## Use it from an AI agent (MCP)

```bash
claude mcp add miragea-shorts -e MIRAGEA_API_KEY=your-key -- uvx --from miragea-shorts miragea-shorts-mcp
```

`miragea-shorts config cursor|claude-desktop|vscode|windsurf` prints the matching JSON snippet. Tools: `shorts_guide`,
`list_voices`, `list_tags`, `plan_short` (free), `make_short`. The agent writes the script itself, so you never need a second LLM key.
Then ask: *"Make a 30-second faceless short about why honey never spoils."*

If your agent supports Miragea's audio skill, tell it: `Install https://miragea.ai/skills/miragea-audio/install.md`.

## How it works

<img src="https://codeberg.org/miragea-voice/miragea-shorts/raw/branch/main/docs/images/flow.png" alt="Flow diagram: script, plan, voice (Miragea API), timing, render with ffmpeg, producing mp4, srt, jpg and json files" width="860">

1. **Script**: 4-8 scenes, one idea each (`miragea-shorts guide` prints the writing rules for you or your agent).
2. **Plan**: validates scenes and the voice, estimates credits. Free, and nothing is generated.
3. **Voice**: one Miragea request per scene, in parallel, with deterministic idempotency keys. Finished scenes are cached by content, so editing one line only pays for that line, and a retry never pays twice.
4. **Timing**: each scene lasts exactly as long as its real audio. Words are spread across it by length and punctuation (an estimate, good to a few hundred milliseconds for short scenes; no speech recognition needed).
5. **Render**: ffmpeg draws a gradient (or your image with a slow zoom), the keyword headline and the highlighted captions, mixes the voice (and optional `--music` at a low level) and burns it all into an H.264/AAC MP4.

### Real output

<img src="https://codeberg.org/miragea-voice/miragea-shorts/raw/branch/main/docs/images/terminal-make.png" alt="Terminal capture of a real miragea-shorts make run: ok True, 16 seconds, 1080x1920, 4 scenes, 43 credits used" width="860">

<img src="https://codeberg.org/miragea-voice/miragea-shorts/raw/branch/main/docs/images/frames.png" alt="Four real frames from the demo short: keyword headlines Honey never spoils, Why, 3,000 years old, Follow for more, with the spoken word highlighted in yellow" width="860">

The numbers above come from one real run (`docs/media/honey-short.json`). Credits depend on word count: 43 words cost 43 credits here.

## Options

| Option | Meaning |
|---|---|
| `--voice` | Saved voice name, `actor:<id>`, or `https://sample.wav\|exact words spoken` |
| `--model` | `expressive` (default, supports delivery tags) or `standard` |
| `--theme` | `midnight`, `sunset`, `forest`, `mono` (background gradients) |
| `--size`, `--fps` | Default `1080x1920` at 30 fps; any even size works (e.g. `1080x1080`) |
| `--highlight` | Colour of the spoken word, default `#FFE600` |
| `--music FILE` | Background track, mixed quietly under the voice |
| `--max-credits N` | Refuse to start if the estimate is higher |
| `--preview` | Free dry run with placeholder tones, to check layout and timing |

Environment: `MIRAGEA_API_KEY` (required), `MIRAGEA_BASE_URL` (default `https://miragea.ai/v1`), `MIRAGEA_OUTPUT_DIR`, `MIRAGEA_DEFAULT_MODEL`, `MIRAGEA_CONCURRENCY`.

## How it compares

Figures read from GitHub mirrors on 2026-12-02. "Voice" is what the project ships by default.

| Project | Form | Stars | License | Voice | Needs |
|---|---|---|---|---|---|
| **miragea-shorts** | CLI + MCP server | new | MIT | Miragea API (saved or cloned voices) | ffmpeg, one API key |
| [short-video-maker](https://github.com/gyoridavid/short-video-maker) | REST + MCP server | ~1.5k | MIT | Local Kokoro TTS | Pexels key, Docker/GPU recommended; last push 2025-06 |
| [MoneyPrinterTurbo](https://github.com/harry0703/MoneyPrinterTurbo) | Web UI + API | ~146k | MIT | Edge TTS and others | LLM key, stock-footage key |
| [MoneyPrinterV2](https://github.com/FujiwaraChoki/MoneyPrinterV2) | Python app | ~33k | AGPL-3.0 | KittenTTS (local) | LLM key, Selenium, ImageMagick |

Those projects do things this one does not: stock-footage search, automatic uploading, a visual UI. miragea-shorts is narrower on purpose: a scriptable, reproducible renderer your agent can drive in three calls, with no stock-footage account and no local model to install.

## FAQ

**How do I make a faceless YouTube Short with AI?**
Write 4-8 scenes, run `miragea-shorts make script.json --voice "My Voice"`, upload the MP4. An agent can do all of it through the MCP server.

**Do I need a GPU or a stock-footage API key?**
No. Voices come from the Miragea API and the video is drawn by ffmpeg (gradient or your own images). There is no local model.

**Can it use my own voice or a cloned voice?**
Yes. Use a saved Miragea voice, or a public sample URL plus the exact words spoken in it. Only clone voices you have the right to use.

**Are the captions exact?**
Scene boundaries are exact (they come from the real audio length). Word highlights inside a scene are estimated from word length and punctuation, which is accurate enough for 5-10 second scenes. If you need recognition-grade timing, run the finished audio through Miragea's subtitle recognition and burn that SRT instead.

**How do I add b-roll or my own pictures?**
Give a scene an `image`; it gets a slow zoom. Stock-footage search is intentionally not included.

**Is it free?**
The code is MIT-licensed. Voice generation uses credits on your Miragea account; `plan` and `--preview` cost nothing.

**Does it work with Claude, Cursor or Codex?**
Yes, via MCP (see above). Any MCP client that supports stdio servers works.

**Can I make horizontal or square video?**
Yes: `--size 1920x1080` or `--size 1080x1080`.

## Troubleshooting

- `missing_api_key`: create a key at https://miragea.ai/workspace/api and export `MIRAGEA_API_KEY`.
- `unknown_voice` / `missing_voice`: run `miragea-shorts voices` and pass a name or `actor:<id>`.
- `ffmpeg_failed ... ass`: your ffmpeg lacks libass. Install a full build (`brew install ffmpeg`, `apt install ffmpeg`).
- `blocked_by_cloudflare`: a VPN or proxy is being challenged; retry from a normal network.
- A scene failed: run the same command again; finished scenes are reused.

## Development

```bash
pip install -e '.[dev]' && pytest && ruff check .
```

Tests use an in-memory fake of the Miragea API (httpx `MockTransport`) and real ffmpeg renders at 270x480; they never spend credits.
Regenerate the README images with `python docs/make_images.py` (needs Pillow). See [CHANGELOG.md](CHANGELOG.md) and [llms.txt](llms.txt).

## License

MIT. Voice generation by [Miragea](https://miragea.ai).
