tokenreel 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ .git
2
+ .github
3
+ assets
4
+ build
5
+ dist
6
+ tests
7
+ tools
8
+ examples
9
+ __pycache__
10
+ *.pyc
11
+ .venv
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: "/"
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,42 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ permissions:
7
+ contents: read
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python: ["3.10", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python }}
19
+ - run: pip install -e ".[dev]"
20
+ - run: ruff check .
21
+ - run: pytest -q
22
+ dependency-review:
23
+ # needs the dependency graph + GHAS, which private free repos lack; runs once public
24
+ if: github.event_name == 'pull_request' && !github.event.repository.private
25
+ runs-on: ubuntu-latest
26
+ permissions:
27
+ contents: read
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: actions/dependency-review-action@v5
31
+ docker:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ - run: docker build -t tokenreel-mcp .
36
+ - run: docker run --rm --entrypoint python tokenreel-mcp -c "import tokenreel.mcp_server as m; print('ok', m.mcp.name)"
37
+ docker-narrate:
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ - run: docker build --build-arg EXTRAS=mcp,tts,align -t tokenreel-narrate .
42
+ - run: docker run --rm --entrypoint python tokenreel-narrate -c "import kokoro_onnx, faster_whisper, tokenreel.mcp_server; print('ok')"
@@ -0,0 +1,43 @@
1
+ name: publish
2
+ # Publishes to PyPI when a GitHub release is published. Uses PyPI trusted publishing
3
+ # (OIDC), so no API token is stored in this repo.
4
+ #
5
+ # One-time setup on pypi.org (account owner only):
6
+ # Account settings > Publishing > Add a pending publisher
7
+ # PyPI project name: tokenreel | Owner: sunilgentyala | Repository: tokenreel
8
+ # Workflow name: publish.yml | Environment name: pypi
9
+ on:
10
+ release:
11
+ types: [published]
12
+ # releases created by the release workflow use GITHUB_TOKEN and do not fire the trigger
13
+ # above, so run this manually from the Actions tab after the pypi.org setup
14
+ workflow_dispatch:
15
+ permissions:
16
+ contents: read
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+ - run: pip install build twine
26
+ - run: python -m build
27
+ - run: twine check dist/*
28
+ - uses: actions/upload-artifact@v4
29
+ with:
30
+ name: dist
31
+ path: dist/
32
+ pypi:
33
+ needs: build
34
+ runs-on: ubuntu-latest
35
+ environment: pypi
36
+ permissions:
37
+ id-token: write
38
+ steps:
39
+ - uses: actions/download-artifact@v4
40
+ with:
41
+ name: dist
42
+ path: dist/
43
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,62 @@
1
+ name: release
2
+ on:
3
+ push:
4
+ tags: ["v*"]
5
+ permissions:
6
+ contents: write
7
+ id-token: write
8
+ attestations: write
9
+ jobs:
10
+ release:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.12"
17
+ - name: Tag must match the package version
18
+ run: |
19
+ V=$(python -c "import re;print(re.search(r'__version__ = \"(.+?)\"', open('src/tokenreel/__init__.py').read()).group(1))")
20
+ test "v$V" = "${GITHUB_REF_NAME}" || { echo "tag ${GITHUB_REF_NAME} does not match package version v$V"; exit 1; }
21
+ - run: pip install build cyclonedx-bom
22
+ - run: python -m build
23
+ - run: pip install -e . && cyclonedx-py environment -o sbom.cdx.json --of JSON
24
+ - uses: actions/attest-build-provenance@v1
25
+ with:
26
+ subject-path: dist/*
27
+ - uses: sigstore/gh-action-sigstore-python@v3.5.0
28
+ with:
29
+ inputs: dist/*.whl dist/*.tar.gz
30
+ - uses: softprops/action-gh-release@v3
31
+ with:
32
+ generate_release_notes: true
33
+ files: |
34
+ dist/*
35
+ sbom.cdx.json
36
+ container:
37
+ runs-on: ubuntu-latest
38
+ permissions:
39
+ contents: read
40
+ packages: write
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: docker/login-action@v3
44
+ with:
45
+ registry: ghcr.io
46
+ username: ${{ github.actor }}
47
+ password: ${{ secrets.GITHUB_TOKEN }}
48
+ - uses: docker/build-push-action@v6
49
+ with:
50
+ context: .
51
+ push: true
52
+ tags: |
53
+ ghcr.io/sunilgentyala/tokenreel:${{ github.ref_name }}
54
+ ghcr.io/sunilgentyala/tokenreel:latest
55
+ - uses: docker/build-push-action@v6
56
+ with:
57
+ context: .
58
+ push: true
59
+ build-args: EXTRAS=mcp,tts,align
60
+ tags: |
61
+ ghcr.io/sunilgentyala/tokenreel:${{ github.ref_name }}-narrate
62
+ ghcr.io/sunilgentyala/tokenreel:narrate
@@ -0,0 +1,24 @@
1
+ name: scorecard
2
+ on:
3
+ # Manual until the repo is public: Scorecard publishing needs a public repo, and the
4
+ # scorecard image pull from gcr.io failed in CI on 2026-11-23 (billing error).
5
+ workflow_dispatch:
6
+ permissions: read-all
7
+ jobs:
8
+ analysis:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ security-events: write
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ persist-credentials: false
17
+ - uses: ossf/scorecard-action@v2.6.0
18
+ with:
19
+ results_file: results.sarif
20
+ results_format: sarif
21
+ publish_results: true
22
+ - uses: github/codeql-action/upload-sarif@v3
23
+ with:
24
+ sarif_file: results.sarif
@@ -0,0 +1,27 @@
1
+ name: traffic-snapshot
2
+ # GitHub keeps 14 days of traffic. This stores a weekly snapshot as a PRIVATE
3
+ # workflow artifact (not committed, not in the README).
4
+ # Needs a repo secret TRAFFIC_TOKEN: a PAT with repo push access.
5
+ on:
6
+ schedule:
7
+ - cron: "23 4 * * 1"
8
+ workflow_dispatch:
9
+ permissions:
10
+ contents: read
11
+ jobs:
12
+ snapshot:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+ - env:
20
+ GH_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
21
+ METRICS_DIR: ${{ runner.temp }}/metrics
22
+ run: python tools/track_traffic.py "${{ github.repository }}"
23
+ - uses: actions/upload-artifact@v7
24
+ with:
25
+ name: traffic-snapshot
26
+ path: ${{ runner.temp }}/metrics/snapshots.jsonl
27
+ retention-days: 90
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ snapshots.jsonl
10
+ .env
@@ -0,0 +1,28 @@
1
+ FROM python:3.12-slim
2
+
3
+ LABEL org.opencontainers.image.source="https://github.com/sunilgentyala/tokenreel" \
4
+ org.opencontainers.image.description="TokenReel MCP server: text to animated, narrated, captioned videos" \
5
+ org.opencontainers.image.licenses="Apache-2.0"
6
+
7
+ # ffmpeg for encoding, DejaVu fonts for frame rendering
8
+ RUN apt-get update \
9
+ && apt-get install -y --no-install-recommends ffmpeg fonts-dejavu-core \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ RUN useradd --create-home --uid 10001 reel
13
+ WORKDIR /app
14
+ COPY pyproject.toml README.md LICENSE ./
15
+ COPY src ./src
16
+ # EXTRAS=mcp (default, silent renders) or mcp,tts,align (narrated; see the -narrate image)
17
+ ARG EXTRAS=mcp
18
+ RUN pip install --no-cache-dir ".[${EXTRAS}]"
19
+
20
+ USER reel
21
+ ENV TOKENREEL_OUT=/home/reel/out
22
+ # Narrated variant: bake the small English recognizer into the image so alignment runs offline.
23
+ # The Kokoro voice model (about 350 MB) is not baked in; mount it read-only:
24
+ # docker run -i --rm -v ~/.tokenreel/models:/home/reel/.tokenreel/models:ro IMAGE-narrate
25
+ RUN if echo "$EXTRAS" | grep -q align; then \
26
+ python -c "from faster_whisper import WhisperModel; WhisperModel('tiny.en', device='cpu', compute_type='int8')"; \
27
+ fi
28
+ ENTRYPOINT ["tokenreel-mcp"]
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.5
2
+ Name: tokenreel
3
+ Version: 0.2.0
4
+ Summary: Turn plain text and technical content into animated, captioned short videos. Offline-first, secure by default.
5
+ Author: Sunil Gentyala
6
+ License: Apache-2.0
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.10
9
+ Provides-Extra: align
10
+ Requires-Dist: faster-whisper>=1.0; extra == 'align'
11
+ Requires-Dist: numpy; extra == 'align'
12
+ Requires-Dist: soundfile; extra == 'align'
13
+ Provides-Extra: dev
14
+ Requires-Dist: mcp>=1.2; extra == 'dev'
15
+ Requires-Dist: pillow>=10; extra == 'dev'
16
+ Requires-Dist: pytest>=8; extra == 'dev'
17
+ Requires-Dist: ruff>=0.6; extra == 'dev'
18
+ Provides-Extra: mcp
19
+ Requires-Dist: mcp>=1.2; extra == 'mcp'
20
+ Requires-Dist: pillow>=10; extra == 'mcp'
21
+ Provides-Extra: nlp
22
+ Requires-Dist: spacy>=3.7; extra == 'nlp'
23
+ Provides-Extra: render
24
+ Requires-Dist: pillow>=10; extra == 'render'
25
+ Provides-Extra: tts
26
+ Requires-Dist: kokoro-onnx>=0.4.7; extra == 'tts'
27
+ Requires-Dist: soundfile; extra == 'tts'
28
+ Description-Content-Type: text/markdown
29
+
30
+ <div align="center">
31
+
32
+ # TokenReel
33
+
34
+ **Turn plain text and technical content into animated, narrated, captioned short videos.**
35
+ Offline-first. No watermark. No cloud TTS. Secure by default.
36
+
37
+ [![CI](https://github.com/sunilgentyala/tokenreel/actions/workflows/ci.yml/badge.svg)](https://github.com/sunilgentyala/tokenreel/actions/workflows/ci.yml)
38
+ ![License](https://img.shields.io/badge/license-Apache--2.0-blue)
39
+ ![Python](https://img.shields.io/badge/python-3.10%2B-3776AB)
40
+
41
+ <img src="assets/demo.gif" alt="TokenReel demo: text, flow, math and code scenes with burned-in captions" width="270">
42
+
43
+ </div>
44
+
45
+ ## What it does
46
+
47
+ Give it Markdown or plain text. TokenReel plans the scenes with NLP, then draws, narrates and
48
+ captions them for Shorts and Reels (1080x1920).
49
+
50
+ | Your text | Scene it becomes |
51
+ |---|---|
52
+ | Prose | **Explainer** card with keyword chips |
53
+ | "First ... Then ... Finally ..." | **Flow** diagram with numbered steps and arrows |
54
+ | Equations and numbers (`x = n / m`, `O(1)`) | **Math** card, spoken as words ("n over m") |
55
+ | Fenced code blocks | **Code** panel with line numbers and syntax colors |
56
+
57
+ ## Why another video generator
58
+
59
+ The popular free tools compose stock footage from a topic. They do not animate code, flows or
60
+ math, and caption tooling often defaults to cloud TTS that sends your script elsewhere.
61
+ TokenReel keeps everything on your machine and is built for technical explainers.
62
+
63
+ ## Quick start
64
+
65
+ ```bash
66
+ pip install -e ".[dev]"
67
+ tokenreel plan examples/demo.md # scene plan as JSON, no extras needed
68
+ tokenreel srt examples/demo.md # estimated captions
69
+ ```
70
+
71
+ Silent preview video (needs [ffmpeg](https://ffmpeg.org) on PATH and the `render` extra):
72
+
73
+ ```bash
74
+ pip install -e ".[render]"
75
+ tokenreel render examples/demo.md
76
+ ```
77
+
78
+ Narrated video with captions burned in, each word highlighted as it is spoken
79
+ (`--plain-captions` for static captions):
80
+
81
+ ```bash
82
+ pip install -e ".[render,tts,align]"
83
+ # download kokoro-v1.0.onnx and voices-v1.0.bin (about 350 MB) from the
84
+ # kokoro-onnx "model-files-v1.0" release into ~/.tokenreel/models
85
+ tokenreel render examples/demo.md --audio --align --burn
86
+ ```
87
+
88
+ Output goes to `build/` as `out.mp4` and `captions.srt`.
89
+
90
+ ## Use it from an AI agent (MCP)
91
+
92
+ TokenReel ships an [MCP](https://modelcontextprotocol.io) server, `tokenreel-mcp`, so an agent
93
+ can plan and render videos for you. It runs locally over stdio.
94
+
95
+ ```bash
96
+ pip install -e ".[mcp,render]"
97
+ claude mcp add tokenreel -- tokenreel-mcp # Claude Code
98
+ ```
99
+
100
+ Or in any MCP client config:
101
+
102
+ ```json
103
+ { "mcpServers": { "tokenreel": { "command": "tokenreel-mcp" } } }
104
+ ```
105
+
106
+ | Tool | What it does |
107
+ |---|---|
108
+ | `plan_scenes` | Split text into scenes (text, flow, math, code) with keywords and flow steps |
109
+ | `make_captions` | Estimated SRT captions |
110
+ | `render_video` | Render an mp4 plus captions, optionally narrated, aligned and burned in |
111
+
112
+ Safety: the client never passes file paths. Output goes to `TOKENREEL_OUT` (default
113
+ `~/tokenreel-output`), one new folder per render, with a restricted file name. Input size and
114
+ scene count are capped.
115
+
116
+ ### Sandboxed, fully offline (container)
117
+
118
+ Two images are published to GHCR:
119
+
120
+ | Image | Can do |
121
+ |---|---|
122
+ | `ghcr.io/sunilgentyala/tokenreel:latest` | plan, captions, silent renders |
123
+ | `ghcr.io/sunilgentyala/tokenreel:narrate` | everything, including narration, exact timings and burned captions (1.6 GB) |
124
+
125
+ The narration image has the small English recognizer baked in. The voice model
126
+ (`kokoro-v1.0.onnx`, `voices-v1.0.bin`, about 350 MB, see the quick start) is mounted, not baked:
127
+
128
+ ```bash
129
+ claude mcp add tokenreel-sandbox -- docker run -i --rm --network none \
130
+ -v ~/.tokenreel/models:/home/reel/.tokenreel/models:ro \
131
+ -v ~/tokenreel-output:/home/reel/out \
132
+ ghcr.io/sunilgentyala/tokenreel:narrate
133
+ ```
134
+
135
+ `--network none` works: nothing needs the network at run time. Paths returned by
136
+ `render_video` are inside the container, so use `video_relative` and `captions_relative`
137
+ (relative to the mounted output folder).
138
+
139
+ ## How it works
140
+
141
+ ```
142
+ text / Markdown
143
+ -> sentence + scene segmentation (code, math, flow, text) and keywords
144
+ -> spoken-form normalization (digits and symbols become words)
145
+ -> local TTS (kokoro-onnx)
146
+ -> word timings (faster-whisper, local; or a calibrated estimate)
147
+ -> frames (Pillow) -> hardened ffmpeg -> mp4 + srt
148
+ ```
149
+
150
+ Word-level timing matters because aligners give no time to bare digits or symbols, so
151
+ narration text is normalized to spoken words before alignment. When the recognizer hears a
152
+ different number of words than the script, its words are used for the captions as-is.
153
+
154
+ ## Security and privacy
155
+
156
+ - Untrusted input is treated as hostile: paths are confined to a working directory, file
157
+ types are allow-listed, ffmpeg runs with list arguments, `-protocol_whitelist file` and a
158
+ timeout, and untrusted URLs never reach ffmpeg (see CVE-2023-6605 for why).
159
+ - Run rendering in a container, ideally with gVisor, with no network and resource limits.
160
+ - Releases ship a CycloneDX SBOM, build provenance attestations and Sigstore signatures.
161
+ - Telemetry is off by default and opt-in only. See [TELEMETRY.md](TELEMETRY.md).
162
+ - Report vulnerabilities privately. See [SECURITY.md](SECURITY.md).
163
+
164
+ ## Design notes
165
+
166
+ - Rendering is our own frame generator plus ffmpeg, not Remotion. Remotion's license requires
167
+ a paid company license for larger organizations, which would burden operators of a
168
+ self-hosted tool.
169
+ - The core installs with zero dependencies. NLP, TTS, alignment and rendering are optional
170
+ extras.
171
+
172
+ ## Status and roadmap
173
+
174
+ Early alpha. Done: scene planning, flow diagrams, offline narration, exact word
175
+ timings, burned-in captions with per-word highlighting. Next: math typesetting, architecture
176
+ diagrams, more voices and languages, a 16:9 layout.
177
+
178
+ ## License
179
+
180
+ Apache-2.0. See [LICENSE](LICENSE).