Skip to main content

TokenReel

Turn plain text and technical content into animated, narrated, captioned short videos. Offline-first. No watermark. No cloud TTS. Secure by default.

CI License Python

TokenReel demo: text, flow, math and code scenes with burned-in captions

What it does

Give it Markdown or plain text. TokenReel plans the scenes with NLP, then draws, narrates and captions them for Shorts and Reels (1080x1920).

Your text Scene it becomes
Prose Explainer card with keyword chips
"First ... Then ... Finally ..." Flow diagram with numbered steps and arrows
Equations and numbers (x = n / m, O(1)) Math card, spoken as words ("n over m")
Fenced code blocks Code panel with line numbers and syntax colors

Why another video generator

The popular free tools compose stock footage from a topic. They do not animate code, flows or math, and caption tooling often defaults to cloud TTS that sends your script elsewhere. TokenReel keeps everything on your machine and is built for technical explainers.

Quick start

pip install -e ".[dev]"
tokenreel plan examples/demo.md      # scene plan as JSON, no extras needed
tokenreel srt examples/demo.md       # estimated captions

Silent preview video (needs ffmpeg on PATH and the render extra):

pip install -e ".[render]"
tokenreel render examples/demo.md

Narrated video with captions burned in, each word highlighted as it is spoken (--plain-captions for static captions):

pip install -e ".[render,tts,align]"
# download kokoro-v1.0.onnx and voices-v1.0.bin (about 350 MB) from the
# kokoro-onnx "model-files-v1.0" release into ~/.tokenreel/models
tokenreel render examples/demo.md --audio --align --burn

Output goes to build/ as out.mp4 and captions.srt.

Use it from an AI agent (MCP)

TokenReel ships an MCP server, tokenreel-mcp, so an agent can plan and render videos for you. It runs locally over stdio.

pip install -e ".[mcp,render]"
claude mcp add tokenreel -- tokenreel-mcp        # Claude Code

Or in any MCP client config:

{ "mcpServers": { "tokenreel": { "command": "tokenreel-mcp" } } }
Tool What it does
plan_scenes Split text into scenes (text, flow, math, code) with keywords and flow steps
make_captions Estimated SRT captions
render_video Render an mp4 plus captions, optionally narrated, aligned and burned in

Safety: the client never passes file paths. Output goes to TOKENREEL_OUT (default ~/tokenreel-output), one new folder per render, with a restricted file name. Input size and scene count are capped.

Sandboxed, fully offline (container)

Two images are published to GHCR:

Image Can do
ghcr.io/sunilgentyala/tokenreel:latest plan, captions, silent renders
ghcr.io/sunilgentyala/tokenreel:narrate everything, including narration, exact timings and burned captions (1.6 GB)

The narration image has the small English recognizer baked in. The voice model (kokoro-v1.0.onnx, voices-v1.0.bin, about 350 MB, see the quick start) is mounted, not baked:

claude mcp add tokenreel-sandbox -- docker run -i --rm --network none \
  -v ~/.tokenreel/models:/home/reel/.tokenreel/models:ro \
  -v ~/tokenreel-output:/home/reel/out \
  ghcr.io/sunilgentyala/tokenreel:narrate

--network none works: nothing needs the network at run time. Paths returned by render_video are inside the container, so use video_relative and captions_relative (relative to the mounted output folder).

How it works

text / Markdown
  -> sentence + scene segmentation (code, math, flow, text) and keywords
  -> spoken-form normalization (digits and symbols become words)
  -> local TTS (kokoro-onnx)
  -> word timings (faster-whisper, local; or a calibrated estimate)
  -> frames (Pillow) -> hardened ffmpeg -> mp4 + srt

Word-level timing matters because aligners give no time to bare digits or symbols, so narration text is normalized to spoken words before alignment. When the recognizer hears a different number of words than the script, its words are used for the captions as-is.

Security and privacy

  • Untrusted input is treated as hostile: paths are confined to a working directory, file types are allow-listed, ffmpeg runs with list arguments, -protocol_whitelist file and a timeout, and untrusted URLs never reach ffmpeg (see CVE-2023-6605 for why).
  • Run rendering in a container, ideally with gVisor, with no network and resource limits.
  • Releases ship a CycloneDX SBOM, build provenance attestations and Sigstore signatures.
  • Telemetry is off by default and opt-in only. See TELEMETRY.md.
  • Report vulnerabilities privately. See SECURITY.md.

Design notes

  • Rendering is our own frame generator plus ffmpeg, not Remotion. Remotion's license requires a paid company license for larger organizations, which would burden operators of a self-hosted tool.
  • The core installs with zero dependencies. NLP, TTS, alignment and rendering are optional extras.

Status and roadmap

Early alpha. Done: scene planning, flow diagrams, offline narration, exact word timings, burned-in captions with per-word highlighting. Next: math typesetting, architecture diagrams, more voices and languages, a 16:9 layout.

License

Apache-2.0. See LICENSE.

Metadata

Release files for tokenreel 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tokenreel 0.2.0
File Size Uploaded Provenance Actions
tokenreel-0.2.0.tar.gz 582.6 kB With provenance Details for tokenreel-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tokenreel 0.2.0
File Interpreter ABI Platform Actions
tokenreel-0.2.0-py3-none-any.whl Python 3 none any Details for tokenreel-0.2.0-py3-none-any.whl

Total release size: 605.4 kB

Release files / tokenreel-0.2.0.tar.gz

Download URL tokenreel-0.2.0.tar.gz
Size 582.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6684e7d097e3f0b5424c350289569027bfceaff91e5f84f7927232e2d9b69a41
BLAKE2b-256 checksum
How to use checksums
54fcb93a9d2c6c389461dd704bc722b8b72e63ec762b7e4cf65f20a272f4b5cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / tokenreel-0.2.0-py3-none-any.whl

Download URL tokenreel-0.2.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecb7ae23f86710b03a6a25abe991a70922dfc12f4abd3a099fc24e25da103672
BLAKE2b-256 checksum
How to use checksums
a2567fca69a3637fcf8ca6e358df83c2cb2ade36da3fc14e527bd844ab9eba44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for tokenreel 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tokenreel-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page