Skip to main content
Glama
README.md
# LumiaClip šŸŽ¬

**Turn long videos into short vertical clips — free, open source, yours.**

LumiaClip is a free, open-source alternative to OpusClip. Give it a long
video (a file, or a link to YouTube / Twitch / Kick / other streaming sites)
and it transcribes it locally with Whisper, finds the best moments, cuts
vertical 9:16 clips with burned-in captions, and writes a title, description,
SEO tags, and a thumbnail for each clip. No paid APIs, no accounts, nothing
uploaded anywhere — everything runs on your own machine.

An AI agent can drive the whole job through the built-in MCP server, or you
can use the interactive `lumia` CLI yourself — including **Lumia Agent**, an
in-CLI chat that fixes clips on plain-language instructions.

> **Original code, original name.** LumiaClip reimplements the *idea* of
> clipping (transcribe → find moments → cut → caption). It does not use
> OpusClip code, branding, or assets.

## Features (v0.1.0)

- **Input:** local video file by path (drag & drop into the terminal) or
  social media links (YouTube, Twitch, Kick, other streaming sites) via
  yt-dlp. Every failure has a fallback and a clear error message.
- **Platform filter first:** TikTok / YouTube Shorts / Instagram Reels /
  Custom presets; clip lengths follow the platform cap; mixed 30s + 60s output.
- **Clip length:** 30s, 60s, or **AUTO** (the AI decides how many clips one
  video yields). Remainder auto-split: a 1:40 video at 30s gives 4Ɨ30s + 1Ɨ20s.
- **AI analysis:** local Whisper transcription (faster-whisper, `tiny` model),
  transcript segment scoring (hook, complete thought, pace, energy), best
  moments ranked.
- **Output per clip:** vertical 9:16 video (720Ɨ1280), word-timed burned-in
  captions inside one universal safe zone (middle band: 8% left / 82% right /
  14% top / 70% bottom — clear of the right-side buttons and bottom bar on
  every platform), generated title, description, SEO tags, and two thumbnails
  (`clip-NN-thumb.jpg` middle frame, `clip-NN-thumb-alt.jpg` early frame).
  A separate `.srt` subtitle file is written per clip. Clips ranked by score.
- **Resume + project folders:** an interrupted job resumes from the failed
  clip instead of starting over (job state is saved to `job-state.json` in
  the run folder after every stage and clip). Finished jobs become named
  project folders (from the clip titles) you can reopen with **View last
  results** to change settings and re-export without re-processing.
- **Preview before export:** review each staged clip as a LARGE terminal
  frame preview, as many times as you want, or open it in your system video
  player with one key — then confirm or reject it before anything is exported.
  (Honest note: a terminal cannot play smooth video like a GUI. The CLI
  preview is large still frames plus open-in-player; the v0.2.0 web UI plays
  the video directly.)
- **Queue / batch:** clip several videos in one run. The queue is always
  visible, with pending / running / done status per video.
- **Parallel jobs:** set how many clips are built at once to speed up the
  queue (Settings menu). Warning: more parallel jobs needs a stronger machine
  (CPU/RAM) and fast internet for link downloads; on a weak machine it is
  slower, not faster.
- **Progress with percentage:** every job shows a progress bar with a
  percentage, so you always know how far it is.
- **Lumia Agent chat in the CLI:** ask in plain language — "make the captions
  bigger", "use the second-best moment for clip 2", "make clip 2 60 seconds",
  "change the title of clip 1 to ..." — and Lumia Agent applies it.
- **Saved settings:** interface (CLI now, web UI in v0.2.0), default platform,
  clip mode, language, output folder, max clips (AUTO mode, default 5), and
  parallel jobs persist between runs (Settings menu).
- **MCP server (stdio):** the core. Tools for download, transcribe, analyse,
  cut, clip assets, list results, and the full `clip_video` pipeline, so any
  MCP-capable AI agent can run the whole job.
- **Languages:** program default English; content in English + Indonesian.

## Install

Requirements: Node.js 20+, Python 3.10+, ffmpeg.

```bash
git clone https://github.com/21xthSerenade/lumiaclip.git
cd lumiaclip
npm install
npm run build

# Python helpers (transcription + link downloads) in a venv:
python3 -m venv .venv
.venv/bin/pip install yt-dlp faster-whisper

# Make the commands available everywhere:
npm link
```

> **Whisper compatibility note:** faster-whisper 1.2.x calls
> `av.open(..., metadata_errors="ignore")`, but newer PyAV removed that
> keyword. `python/transcribe.py` ships a small compatibility shim that strips
> the unsupported keyword, so transcription works on any PyAV version.

## Quickstart

```bash
lumia                                   # interactive menu
lumia clip video.mp4 --platform tiktok --mode auto
lumia clip video.mp4 video2.mp4 --platform shorts --mode 30 --lang id
lumia clip https://www.youtube.com/watch?v=... --platform reels --mode mixed
```

Interactive menu:

```
1. Clip a video
2. View last results
3. Chat with Lumia Agent (fix clips)
4. Change Language
5. Settings
6. Help
7. Connect AI Agent (MCP)
8. Exit
```

The clip flow asks for the source (file path or link — several separated by
commas for a queue), the target platform, the clip mode, and the content
language, shows a summary, runs with a progress bar, then lets you preview
and confirm each clip before export. Results land in `./lumiaclip-output/`
(or your configured output folder) with a `result.json` manifest.

### What lands in a project folder

```
<output>/<project-slug-from-clip-titles>/
ā”œā”€ā”€ clip-01.mp4            # staged clip (also in export/ once confirmed)
ā”œā”€ā”€ clip-01.ass            # burned-in caption source
ā”œā”€ā”€ clip-01.srt            # separate subtitle file, same timings
ā”œā”€ā”€ clip-01-thumb.jpg      # thumbnail option 1 (middle frame)
ā”œā”€ā”€ clip-01-thumb-alt.jpg  # thumbnail option 2 (early frame)
ā”œā”€ā”€ transcript.json        # Whisper word-timed transcript
ā”œā”€ā”€ moments.json           # picked moments + scores
ā”œā”€ā”€ job-state.json         # resume state (stage + per-clip status)
ā”œā”€ā”€ project.json           # project metadata for reopening
ā”œā”€ā”€ result.json            # manifest: titles, tags, scores, hook scores
└── export/                # only the clips you confirmed
    ā”œā”€ā”€ clip-01.mp4
    ā”œā”€ā”€ clip-01-thumb.jpg
    └── clip-01.srt
```

### Lumia Agent chat

After a run, pick **Chat with Lumia Agent** and talk in plain language:

| Say | What happens |
| --- | --- |
| `make the captions bigger` / `smaller` | Caption font +8/āˆ’8 px (28–64), clips re-rendered |
| `use highlight captions` / `use classic captions` | Caption style switched, all clips re-rendered |
| `use thumbnail 2` / `use the other thumbnail` | Switches to the other thumbnail (no re-render) |
| `use the second-best moment for clip 2` | Clip rebuilt from the next-best moment |
| `make clip 2 60 seconds` | Clip rebuilt at the new length (10–300s) |
| `change the title of clip 1 to My Title` | Title + thumbnail regenerated |
| `regenerate the thumbnail of clip 2` | Thumbnail rebuilt |
| `preview clip 1` | Large frame preview of that clip |
| `show clips` | List clips with score + hook score |
| `export` | Confirm (export) all remaining clips |
| `help` | List everything the chat understands |
| `quit` | Leave the chat |

The chat is a local offline intent parser (no LLM, no API keys). For full
free-form conversation, connect a real AI agent through the MCP server —
that agent is also called Lumia Agent when it runs this stack.

## MCP server (for AI agents)

Start it:

```bash
lumiaclip-mcp
```

Add this to your MCP client config (Claude, Cursor, VS Code, ...):

```json
{
  "mcpServers": {
    "lumiaclip": {
      "command": "node",
      "args": ["/path/to/lumiaclip/dist/mcp.js"]
    }
  }
}
```

Or pick **Connect AI Agent** in the `lumia` menu — it prints the exact config
for your machine.

**Tools:** `download_video`, `transcribe_video`, `analyse_moments`,
`cut_clips`, `clip_assets`, `list_results`, `clip_video`.

**Agent with its own VM (e.g. Hoshilily):** send the agent the repo URL. The
agent clones it, runs `npm install && npm run build`, starts the MCP server
with the config above, and it auto-connects. The agent — Lumia Agent — can
then: analyse which parts of a video are good to clip, cut the clips, write
captions, titles, descriptions, SEO tags, and thumbnails.

## Platform presets

| Platform | Max clip | Lengths | Default (AUTO) |
| -------- | -------- | ------- | -------------- |
| TikTok | 600s | 30, 60 | 30s |
| YouTube Shorts | 180s | 30, 60 | 60s |
| Instagram Reels | 540s | 30, 60, 90 | 60s |
| Custom | 600s | 30, 60, 90 | 30s |

## Troubleshooting / fallbacks

| Problem | What LumiaClip does |
| ------- | ------------------- |
| Link cannot be downloaded (site blocks yt-dlp) | Clear error + asks for the video file instead |
| yt-dlp fails with `SSL: CERTIFICATE_VERIFY_FAILED` | Your network intercepts TLS (corporate / VPN / egress proxy). On a normal network the same link works. Workaround: download the file yourself and give LumiaClip the path |
| Whisper not installed / transcription fails | Falls back to equal time split, says so in the output |
| No strong moments in the transcript | Falls back to equal time split |
| File not found / not a video | Clear error + how to fix it (drag & drop the file) |
| Clip over the platform cap | Lengths are clamped to the platform preset |
| A video fails in a direct-mode queue (`lumia clip a.mp4 b.mp4`) | The queue stops at the first failed input and exits 1. In the interactive menu the queue continues with the next video instead |

## Roadmap

- **v0.2.0 — localhost web UI.** Design direction in [`docs/DESIGN.md`](docs/DESIGN.md):
  dark minimal console (reference: "Collaborating Inside the Console" by
  Jeremy Blaze), AI chat panel left, clip list middle, clip preview/editor
  right, terminal/log strip bottom; very dark blue-black background
  (`#06070B`-ish), white/grey text, teal accent `#64BACE`. Chat integrated in
  the console, not a popup.
- Later: virality scoring, face-tracking reframe, auto-posting.

## License

MIT — see [LICENSE](LICENSE). Made by 21xthSerenade.