kinescript 1.1.0__tar.gz → 1.1.1__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.
Files changed (55) hide show
  1. kinescript-1.1.1/PKG-INFO +263 -0
  2. kinescript-1.1.1/README.md +217 -0
  3. kinescript-1.1.1/kinescript/__init__.py +13 -0
  4. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/components.py +13 -5
  5. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/docs.py +11 -6
  6. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/render.py +36 -35
  7. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/render3d.py +60 -17
  8. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/scene.py +3 -2
  9. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/schema.py +14 -8
  10. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/timing.py +32 -10
  11. kinescript-1.1.1/kinescript.egg-info/PKG-INFO +263 -0
  12. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript.egg-info/SOURCES.txt +1 -0
  13. kinescript-1.1.1/kinescript.egg-info/requires.txt +12 -0
  14. {kinescript-1.1.0 → kinescript-1.1.1}/pyproject.toml +21 -5
  15. {kinescript-1.1.0 → kinescript-1.1.1}/tests/test_core.py +44 -0
  16. {kinescript-1.1.0 → kinescript-1.1.1}/tests/test_models.py +15 -0
  17. kinescript-1.1.1/tests/test_packaging.py +160 -0
  18. kinescript-1.1.0/PKG-INFO +0 -192
  19. kinescript-1.1.0/README.md +0 -153
  20. kinescript-1.1.0/kinescript/__init__.py +0 -6
  21. kinescript-1.1.0/kinescript.egg-info/PKG-INFO +0 -192
  22. kinescript-1.1.0/kinescript.egg-info/requires.txt +0 -7
  23. {kinescript-1.1.0 → kinescript-1.1.1}/LICENSE +0 -0
  24. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/cli.py +0 -0
  25. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/color.py +0 -0
  26. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/ease.py +0 -0
  27. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/IBMPlexMono-Bold.ttf +0 -0
  28. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/IBMPlexMono-Medium.ttf +0 -0
  29. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/IBMPlexMono-OFL.txt +0 -0
  30. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/IBMPlexMono-Regular.ttf +0 -0
  31. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/IBMPlexMono-SemiBold.ttf +0 -0
  32. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/SpaceGrotesk-Bold.ttf +0 -0
  33. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/SpaceGrotesk-Medium.ttf +0 -0
  34. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/SpaceGrotesk-OFL.txt +0 -0
  35. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/SpaceGrotesk-Regular.ttf +0 -0
  36. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/fonts/SpaceGrotesk-SemiBold.ttf +0 -0
  37. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/mcp.py +0 -0
  38. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/media.py +0 -0
  39. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/mesh.py +0 -0
  40. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/models.py +0 -0
  41. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/output.py +0 -0
  42. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/presets.py +0 -0
  43. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/props.py +0 -0
  44. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/shaders.py +0 -0
  45. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/space.py +0 -0
  46. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/svgpath.py +0 -0
  47. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript/verify.py +0 -0
  48. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript.egg-info/dependency_links.txt +0 -0
  49. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript.egg-info/entry_points.txt +0 -0
  50. {kinescript-1.1.0 → kinescript-1.1.1}/kinescript.egg-info/top_level.txt +0 -0
  51. {kinescript-1.1.0 → kinescript-1.1.1}/setup.cfg +0 -0
  52. {kinescript-1.1.0 → kinescript-1.1.1}/tests/test_color_pipeline.py +0 -0
  53. {kinescript-1.1.0 → kinescript-1.1.1}/tests/test_docs.py +0 -0
  54. {kinescript-1.1.0 → kinescript-1.1.1}/tests/test_motion_blur.py +0 -0
  55. {kinescript-1.1.0 → kinescript-1.1.1}/tests/test_schema.py +0 -0
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: kinescript
3
+ Version: 1.1.1
4
+ Summary: Render motion graphics and video edits from JSON scenes on the GPU, with checks an agent can read.
5
+ Author: Dr. Know How
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://drknowhow.github.io/kinescript/
8
+ Project-URL: Documentation, https://drknowhow.github.io/kinescript/
9
+ Project-URL: Source, https://github.com/drknowhow/kinescript
10
+ Project-URL: Issues, https://github.com/drknowhow/kinescript/issues
11
+ Project-URL: Changelog, https://github.com/drknowhow/kinescript/blob/main/CHANGELOG.md
12
+ Keywords: video,video rendering,video editing,programmatic video,motion graphics,animation,json,skia,gpu,ffmpeg,3d,captions,mcp,ai agents
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Console
15
+ Classifier: Environment :: GPU
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Programming Language :: Python :: Implementation :: CPython
26
+ Classifier: Topic :: Artistic Software
27
+ Classifier: Topic :: Multimedia :: Graphics
28
+ Classifier: Topic :: Multimedia :: Video
29
+ Classifier: Topic :: Multimedia :: Video :: Conversion
30
+ Classifier: Topic :: Multimedia :: Video :: Non-Linear Editor
31
+ Requires-Python: >=3.10
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ License-File: kinescript/fonts/IBMPlexMono-OFL.txt
35
+ License-File: kinescript/fonts/SpaceGrotesk-OFL.txt
36
+ Requires-Dist: skia-python>=87
37
+ Requires-Dist: numpy>=1.24
38
+ Requires-Dist: glfw>=2.5
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=8; extra == "dev"
41
+ Requires-Dist: build>=1.2; extra == "dev"
42
+ Requires-Dist: readme_renderer[md]>=43; extra == "dev"
43
+ Requires-Dist: trove-classifiers; extra == "dev"
44
+ Requires-Dist: tomli>=2; python_version < "3.11" and extra == "dev"
45
+ Dynamic: license-file
46
+
47
+ <p align="center"><img src="https://raw.githubusercontent.com/drknowhow/kinescript/main/brand/logo-dark.png" width="460" alt="kinescript"></p>
48
+
49
+ <p align="center"><b>Video you can diff.</b><br>Motion graphics and video edits written as JSON, checked by agents, rendered on the GPU.</p>
50
+
51
+ <p align="center"><a href="https://drknowhow.github.io/kinescript/">Documentation</a> · <a href="https://github.com/drknowhow/kinescript">Source</a> · <a href="https://github.com/drknowhow/kinescript/blob/main/CHANGELOG.md">Changelog</a> · <a href="https://github.com/drknowhow/kinescript/blob/main/docs/promo.mp4">Launch video</a></p>
52
+
53
+ <p align="center"><img src="https://raw.githubusercontent.com/drknowhow/kinescript/main/docs/hero.gif" width="720" alt="The Kinescript launch video, rendered by Kinescript"></p>
54
+
55
+ Kinescript turns a JSON scene into video. Every layer, keyframe and cut is a line of data, so a scene can be
56
+ generated, reviewed in a pull request, and changed by a script or an agent. The renderer is a pure function of
57
+ the frame number: any frame renders on its own, which makes previews instant and lets a render split across
58
+ processes.
59
+
60
+ ```bash
61
+ pip install kinescript
62
+ kine doctor
63
+ ```
64
+
65
+ It needs Python 3.10 or newer and ffmpeg on your `PATH` ([details](https://github.com/drknowhow/kinescript#install)).
66
+
67
+ The [launch video](https://github.com/drknowhow/kinescript/blob/main/docs/promo.mp4) is a Kinescript scene,
68
+ [`marketing/promo.json`](https://github.com/drknowhow/kinescript/blob/main/marketing/promo.json). It is 35
69
+ seconds of 1080p and renders, with audio, in about 3.5 seconds on the development machine. The
70
+ [project site](https://drknowhow.github.io/kinescript/) shows more demos, each next to the scene file it was
71
+ rendered from.
72
+
73
+ ## What it does
74
+
75
+ - **Cue timing.** Start and end times can name other layers: `"at": "title.out+0.2"`. Lengthen one layer and
76
+ everything cued after it moves. Cycles and missing references are reported with the ids involved.
77
+ - **Animate anything.** Numbers and colours take constants, keyframes (`[[0, 0], [0.6, 1, "outBack"]]`, with
78
+ negative times counted from the layer's end), a tween object, or an expression such as `"=540 + sin(t*3)*40"`.
79
+ Colours interpolate in OKLab.
80
+ - **Text that moves per letter.** `"split": "chars"` (or words, or lines) with a staggered enter motion, a
81
+ typewriter reveal with a caret, `**emphasis**` markup, and per-unit expressions (`"unitY": "=sin(T*4 + i)*12"`
82
+ for a wave).
83
+ - **Footage.** Video layers with trim, speed, loop, cover/contain fit, punch-in `zoom` around a `focus` point, and
84
+ rounded picture-in-picture. A `sequence` turns a cut list into clips with fade, wipe, slide, zoom or blur
85
+ transitions. Clip audio and music beds are mixed automatically.
86
+ - **Captions** from `.srt`/`.vtt` or inline cues, with karaoke and pop modes.
87
+ - **Shaders.** SkSL layers with `mesh`, `aurora`, `grid` and `score` presets, or your own source.
88
+ - **Finishing.** Per-layer blur, shadow, blend modes and colour adjustments; a scene grade with vignette and film
89
+ grain; optional motion blur.
90
+ - **Components.** `lowerThird`, `titleCard`, `callout`, `focus` (dim everything but a region), `progress`,
91
+ `kinetic`, plus your own with `{{param}}` placeholders.
92
+ - **Outputs.** H.264 `.mp4`, ProRes 4444 `.mov` and VP9 `.webm` with alpha for compositing, `.gif`, PNG sequences.
93
+
94
+ ## 3D
95
+
96
+ Depth and models are drawn by the same Skia renderer as everything else, with no extra dependency. Scenes that use
97
+ no depth draw exactly as before.
98
+
99
+ - **Camera and depth on any layer.** Every layer takes `z`, `rotateX`, `rotateY` and `backface`. A top-level
100
+ `camera` pans, dollies, orbits and rolls with perspective; `fixed` layers ignore its moves, and a group with
101
+ `"sort": "depth"` draws its children far to near. The `flip`, `flip-up`, `tumble` and `push` motions work on
102
+ whole layers and per letter with `split`. A two-sided card is a group with `"backface": "hidden"` on each side.
103
+ - **Model layers.** `"type": "model"` draws a lit `cube`, `sphere`, `cylinder`, `cone`, `torus` or `plane`, or
104
+ several shapes merged as `parts` so their triangles are depth-sorted together. Materials take `fill`, `shine`,
105
+ `metal`, `rim` and `bands` (toon steps). `light`, for the scene or one model, takes `studio`, `soft`,
106
+ `dramatic` or `flat`, or your own amounts. `explode` sends faces outward and the `build` motion assembles a model.
107
+ - **Extruded text and SVG paths.** `"shape": "text"` extrudes letters in any font and `"shape": "path"` extrudes
108
+ SVG path data, filled, or stroked with `strokeWidth` for line icons. Both take a `depth` and a 45-degree `bevel`.
109
+ - **Model files.** `src` reads `.glb` and `.gltf` (glTF 2.0) and `.obj` with its `.mtl`: node transforms, base
110
+ colours, and metallic and roughness as `metal` and `shine`. `ground` puts a soft shadow under any model.
111
+
112
+ A 3D title that builds in and turns to face the camera:
113
+
114
+ ```json
115
+ {"id": "title3d", "type": "model", "shape": "text", "text": "LAUNCH",
116
+ "x": "50%", "y": "50%", "size": 240, "weight": 800, "depth": 70, "bevel": 5,
117
+ "rotateY": [[0, -40], [2.4, 0, "outCubic"]], "rotateX": [[0, 18], [2.4, 0, "outCubic"]],
118
+ "shine": 0.6, "enter": {"name": "build", "dur": 1.2}}
119
+ ```
120
+
121
+ ## Built for agents
122
+
123
+ An agent cannot watch a video, so Kinescript gives it things it can read:
124
+
125
+ | Command | What the agent gets |
126
+ |---|---|
127
+ | `kine docs` | the full scene reference, short enough to keep in context |
128
+ | `kine check scene.json` | every problem at once as JSON, each with its layer, time range and a fix |
129
+ | `kine look scene.json --boxes` | one PNG of many labelled frames, with every layer outlined and the top-level ones named |
130
+ | `kine probe scene.json --at 3.2` | resolved in/out of every layer and each visible layer's screen box |
131
+ | `kine still` / `kine render` | a frame, a range (`--from/--to`), a draft (`-q draft --scale 0.5`) or the final file |
132
+ | `kine watch scene.json` | the contact sheet, made again every time the file is saved |
133
+
134
+ `kine check` reports unknown keys and bad values, missing media and out-of-range trims, text off the canvas or
135
+ in the safe margin, overlapping text, contrast under 3:1 against what is actually behind the text, tiny text and
136
+ too little reading time. An unknown key names the intended key first. Common names from other tools (`color`,
137
+ `fontSize`, `duration`, `position`) are read and reported as info notes. It exits with status 1 while there are
138
+ errors.
139
+
140
+ The same tools are available over MCP (`kine mcp`) as `kine_docs`, `kine_check`, `kine_look`, `kine_still`,
141
+ `kine_probe` and `kine_render`. They take a scene as a file path or as the JSON object itself, and `kine_look`
142
+ and `kine_still` return images inline.
143
+
144
+ ```json
145
+ {
146
+ "mcpServers": {
147
+ "kinescript": {"command": "kine", "args": ["mcp"]}
148
+ }
149
+ }
150
+ ```
151
+
152
+ ## Install
153
+
154
+ Requires Python 3.10+ and ffmpeg on `PATH` (for example `winget install Gyan.FFmpeg`, `brew install ffmpeg` or
155
+ `sudo apt install ffmpeg`). On Linux, `skia-python` also loads the system's EGL, GL and fontconfig libraries, even
156
+ with `KINE_BACKEND=cpu`. A bare container or server needs `sudo apt install libegl1 libgl1 libfontconfig1`, or
157
+ importing Kinescript fails with `libEGL.so.1: cannot open shared object file`.
158
+
159
+ ```bash
160
+ pip install kinescript
161
+ kine doctor # ffmpeg path, GPU availability, default font
162
+ ```
163
+
164
+ From a checkout: `pip install -e .`
165
+
166
+ Dependencies are `skia-python`, `numpy` and `glfw`. Space Grotesk and IBM Plex Mono (both SIL Open Font License)
167
+ ship with the package, so default text looks the same on every machine.
168
+
169
+ ## Quick start
170
+
171
+ ```bash
172
+ kine new scene.json
173
+ kine check scene.json
174
+ kine look scene.json --boxes
175
+ kine render scene.json -o scene.mp4
176
+ ```
177
+
178
+ ```json
179
+ {
180
+ "canvas": {"w": 1920, "h": 1080, "fps": 30, "bg": "#0a0c10"},
181
+ "grade": {"vignette": 0.35, "grain": 0.04},
182
+ "layers": [
183
+ {"id": "dot", "type": "circle", "x": "50%", "y": "50%", "r": 26, "fill": "$accent",
184
+ "dur": 1.1, "enter": {"name": "pop", "dur": 0.4}, "exit": "fade"},
185
+ {"id": "title", "type": "text", "text": "Motion, **written.**", "x": "50%",
186
+ "y": "46%", "size": 140, "weight": 700, "split": "chars", "at": "dot.out-0.1",
187
+ "dur": 3.2, "enter": {"name": "snap", "stagger": 0.03}, "exit": "fade"},
188
+ {"id": "sub", "type": "text", "text": "scenes as data", "x": "50%", "y": "62%",
189
+ "size": 40, "fill": "$muted", "at": "title.in+0.6", "until": "title.out",
190
+ "enter": "rise"}
191
+ ]
192
+ }
193
+ ```
194
+
195
+ More scenes in [`examples/`](https://github.com/drknowhow/kinescript/tree/main/examples):
196
+
197
+ - [`hello.json`](https://github.com/drknowhow/kinescript/blob/main/examples/hello.json): a title animation, 4.2 s.
198
+ - [`edit.json`](https://github.com/drknowhow/kinescript/blob/main/examples/edit.json): a cut list with a
199
+ punch-in, a transition, a lower third, a callout, karaoke captions and a music bed, 10.4 s.
200
+ - [`3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/3d.json): a camera move past layers
201
+ at several depths and a card that turns over, 6 s.
202
+ - [`model.json`](https://github.com/drknowhow/kinescript/blob/main/examples/model.json): lit primitives and a
203
+ ring around a ball that builds in and flies apart, 6 s.
204
+ - [`title3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/title3d.json): the brand mark as an
205
+ extruded SVG path and the wordmark as extruded text, 5 s.
206
+ - [`import.json`](https://github.com/drknowhow/kinescript/blob/main/examples/import.json): a glTF rocket on a
207
+ ground shadow, 6 s.
208
+
209
+ `edit.json` and `import.json` read sample media: run `python examples/make_media.py` first to generate it.
210
+
211
+ ## Performance
212
+
213
+ Measured on the development machine (Intel Core Ultra 7 265, 20 threads, NVIDIA RTX 5060 Ti, Windows 11),
214
+ 2026-10-30:
215
+
216
+ | Workload | Result |
217
+ |---|---|
218
+ | Drawing one 1080p frame of the launch video on the GPU, converted to I420 and read back as a render does | median 2.7 ms, p95 3.3 ms (all 1038 frames) |
219
+ | Launch video, 34.6 s at 1080p30, `-q high`, with audio | 3.5 s wall, about 300 frames/s (median of 5 runs) |
220
+ | `examples/edit.json`, 10.4 s with two decoded video clips | 2.05 s wall, 152 frames/s (median of 5 runs) |
221
+
222
+ [`python bench/stages.py`](https://github.com/drknowhow/kinescript/blob/main/bench/stages.py) splits the time
223
+ per frame into drawing, conversion and readback, and writing to ffmpeg for several workloads, and times whole
224
+ renders.
225
+
226
+ Rendering uses Skia on the GPU through a hidden OpenGL context, one per worker process. Frames are split into
227
+ chunks, encoded in parallel and joined without re-encoding, while another ffmpeg process mixes the audio.
228
+ Within one process, such as the MCP server, the workers stay warm for two minutes between renders.
229
+
230
+ ## Limits
231
+
232
+ - Without a usable GPU, Kinescript falls back to Skia's CPU rasteriser. With the Windows `skia-python` wheel this is
233
+ very slow (about 0.65 s per 1080p frame for the launch video); use `--scale 0.5` for previews on such machines.
234
+ `KINE_BACKEND=cpu` forces this path.
235
+ - 3D is drawn by Skia with a depth sort, not a GL pipeline: models have no image textures, skeletal animation or
236
+ shadows cast on each other, and separate model layers do not hide each other per pixel (merge touching
237
+ objects as `parts` of one model). Draco- and meshopt-compressed model files are not read.
238
+ - Audio is mixing (trim, gain, fades, speed), not editing or effects.
239
+ - Video is decoded and resampled by ffmpeg to the scene frame rate. Jumping backwards or far ahead reopens the
240
+ decoder, which is slower than sequential playback.
241
+ - Text layout is single-script left-to-right with greedy wrapping. No shaping for complex scripts or bidi.
242
+ - Expressions are limited to arithmetic and the listed helpers; attribute access and other names are rejected.
243
+
244
+ ## Project layout
245
+
246
+ ```
247
+ kinescript/ engine: timing, props, scene, components, render (Skia), space, render3d,
248
+ mesh and models (3D), output (encoding and the audio mix),
249
+ verify (check, look, probe), schema, docs, mcp, cli
250
+ examples/ example scenes and the generator for sample media
251
+ marketing/ the launch video as a scene and its builder; build_site.py renders the site
252
+ site/ the project site: demo scenes next to the videos rendered from them
253
+ brand/ logo files, generated art and the brand guide
254
+ bench/ per-stage timing of frames and whole renders
255
+ content/ launch post and social copy
256
+ tests/ pytest suite
257
+ ```
258
+
259
+ ## License
260
+
261
+ MIT, see [`LICENSE`](https://github.com/drknowhow/kinescript/blob/main/LICENSE). The bundled fonts are under the
262
+ SIL Open Font License 1.1; their notices are in
263
+ [`kinescript/fonts/`](https://github.com/drknowhow/kinescript/tree/main/kinescript/fonts).
@@ -0,0 +1,217 @@
1
+ <p align="center"><img src="https://raw.githubusercontent.com/drknowhow/kinescript/main/brand/logo-dark.png" width="460" alt="kinescript"></p>
2
+
3
+ <p align="center"><b>Video you can diff.</b><br>Motion graphics and video edits written as JSON, checked by agents, rendered on the GPU.</p>
4
+
5
+ <p align="center"><a href="https://drknowhow.github.io/kinescript/">Documentation</a> · <a href="https://github.com/drknowhow/kinescript">Source</a> · <a href="https://github.com/drknowhow/kinescript/blob/main/CHANGELOG.md">Changelog</a> · <a href="https://github.com/drknowhow/kinescript/blob/main/docs/promo.mp4">Launch video</a></p>
6
+
7
+ <p align="center"><img src="https://raw.githubusercontent.com/drknowhow/kinescript/main/docs/hero.gif" width="720" alt="The Kinescript launch video, rendered by Kinescript"></p>
8
+
9
+ Kinescript turns a JSON scene into video. Every layer, keyframe and cut is a line of data, so a scene can be
10
+ generated, reviewed in a pull request, and changed by a script or an agent. The renderer is a pure function of
11
+ the frame number: any frame renders on its own, which makes previews instant and lets a render split across
12
+ processes.
13
+
14
+ ```bash
15
+ pip install kinescript
16
+ kine doctor
17
+ ```
18
+
19
+ It needs Python 3.10 or newer and ffmpeg on your `PATH` ([details](https://github.com/drknowhow/kinescript#install)).
20
+
21
+ The [launch video](https://github.com/drknowhow/kinescript/blob/main/docs/promo.mp4) is a Kinescript scene,
22
+ [`marketing/promo.json`](https://github.com/drknowhow/kinescript/blob/main/marketing/promo.json). It is 35
23
+ seconds of 1080p and renders, with audio, in about 3.5 seconds on the development machine. The
24
+ [project site](https://drknowhow.github.io/kinescript/) shows more demos, each next to the scene file it was
25
+ rendered from.
26
+
27
+ ## What it does
28
+
29
+ - **Cue timing.** Start and end times can name other layers: `"at": "title.out+0.2"`. Lengthen one layer and
30
+ everything cued after it moves. Cycles and missing references are reported with the ids involved.
31
+ - **Animate anything.** Numbers and colours take constants, keyframes (`[[0, 0], [0.6, 1, "outBack"]]`, with
32
+ negative times counted from the layer's end), a tween object, or an expression such as `"=540 + sin(t*3)*40"`.
33
+ Colours interpolate in OKLab.
34
+ - **Text that moves per letter.** `"split": "chars"` (or words, or lines) with a staggered enter motion, a
35
+ typewriter reveal with a caret, `**emphasis**` markup, and per-unit expressions (`"unitY": "=sin(T*4 + i)*12"`
36
+ for a wave).
37
+ - **Footage.** Video layers with trim, speed, loop, cover/contain fit, punch-in `zoom` around a `focus` point, and
38
+ rounded picture-in-picture. A `sequence` turns a cut list into clips with fade, wipe, slide, zoom or blur
39
+ transitions. Clip audio and music beds are mixed automatically.
40
+ - **Captions** from `.srt`/`.vtt` or inline cues, with karaoke and pop modes.
41
+ - **Shaders.** SkSL layers with `mesh`, `aurora`, `grid` and `score` presets, or your own source.
42
+ - **Finishing.** Per-layer blur, shadow, blend modes and colour adjustments; a scene grade with vignette and film
43
+ grain; optional motion blur.
44
+ - **Components.** `lowerThird`, `titleCard`, `callout`, `focus` (dim everything but a region), `progress`,
45
+ `kinetic`, plus your own with `{{param}}` placeholders.
46
+ - **Outputs.** H.264 `.mp4`, ProRes 4444 `.mov` and VP9 `.webm` with alpha for compositing, `.gif`, PNG sequences.
47
+
48
+ ## 3D
49
+
50
+ Depth and models are drawn by the same Skia renderer as everything else, with no extra dependency. Scenes that use
51
+ no depth draw exactly as before.
52
+
53
+ - **Camera and depth on any layer.** Every layer takes `z`, `rotateX`, `rotateY` and `backface`. A top-level
54
+ `camera` pans, dollies, orbits and rolls with perspective; `fixed` layers ignore its moves, and a group with
55
+ `"sort": "depth"` draws its children far to near. The `flip`, `flip-up`, `tumble` and `push` motions work on
56
+ whole layers and per letter with `split`. A two-sided card is a group with `"backface": "hidden"` on each side.
57
+ - **Model layers.** `"type": "model"` draws a lit `cube`, `sphere`, `cylinder`, `cone`, `torus` or `plane`, or
58
+ several shapes merged as `parts` so their triangles are depth-sorted together. Materials take `fill`, `shine`,
59
+ `metal`, `rim` and `bands` (toon steps). `light`, for the scene or one model, takes `studio`, `soft`,
60
+ `dramatic` or `flat`, or your own amounts. `explode` sends faces outward and the `build` motion assembles a model.
61
+ - **Extruded text and SVG paths.** `"shape": "text"` extrudes letters in any font and `"shape": "path"` extrudes
62
+ SVG path data, filled, or stroked with `strokeWidth` for line icons. Both take a `depth` and a 45-degree `bevel`.
63
+ - **Model files.** `src` reads `.glb` and `.gltf` (glTF 2.0) and `.obj` with its `.mtl`: node transforms, base
64
+ colours, and metallic and roughness as `metal` and `shine`. `ground` puts a soft shadow under any model.
65
+
66
+ A 3D title that builds in and turns to face the camera:
67
+
68
+ ```json
69
+ {"id": "title3d", "type": "model", "shape": "text", "text": "LAUNCH",
70
+ "x": "50%", "y": "50%", "size": 240, "weight": 800, "depth": 70, "bevel": 5,
71
+ "rotateY": [[0, -40], [2.4, 0, "outCubic"]], "rotateX": [[0, 18], [2.4, 0, "outCubic"]],
72
+ "shine": 0.6, "enter": {"name": "build", "dur": 1.2}}
73
+ ```
74
+
75
+ ## Built for agents
76
+
77
+ An agent cannot watch a video, so Kinescript gives it things it can read:
78
+
79
+ | Command | What the agent gets |
80
+ |---|---|
81
+ | `kine docs` | the full scene reference, short enough to keep in context |
82
+ | `kine check scene.json` | every problem at once as JSON, each with its layer, time range and a fix |
83
+ | `kine look scene.json --boxes` | one PNG of many labelled frames, with every layer outlined and the top-level ones named |
84
+ | `kine probe scene.json --at 3.2` | resolved in/out of every layer and each visible layer's screen box |
85
+ | `kine still` / `kine render` | a frame, a range (`--from/--to`), a draft (`-q draft --scale 0.5`) or the final file |
86
+ | `kine watch scene.json` | the contact sheet, made again every time the file is saved |
87
+
88
+ `kine check` reports unknown keys and bad values, missing media and out-of-range trims, text off the canvas or
89
+ in the safe margin, overlapping text, contrast under 3:1 against what is actually behind the text, tiny text and
90
+ too little reading time. An unknown key names the intended key first. Common names from other tools (`color`,
91
+ `fontSize`, `duration`, `position`) are read and reported as info notes. It exits with status 1 while there are
92
+ errors.
93
+
94
+ The same tools are available over MCP (`kine mcp`) as `kine_docs`, `kine_check`, `kine_look`, `kine_still`,
95
+ `kine_probe` and `kine_render`. They take a scene as a file path or as the JSON object itself, and `kine_look`
96
+ and `kine_still` return images inline.
97
+
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "kinescript": {"command": "kine", "args": ["mcp"]}
102
+ }
103
+ }
104
+ ```
105
+
106
+ ## Install
107
+
108
+ Requires Python 3.10+ and ffmpeg on `PATH` (for example `winget install Gyan.FFmpeg`, `brew install ffmpeg` or
109
+ `sudo apt install ffmpeg`). On Linux, `skia-python` also loads the system's EGL, GL and fontconfig libraries, even
110
+ with `KINE_BACKEND=cpu`. A bare container or server needs `sudo apt install libegl1 libgl1 libfontconfig1`, or
111
+ importing Kinescript fails with `libEGL.so.1: cannot open shared object file`.
112
+
113
+ ```bash
114
+ pip install kinescript
115
+ kine doctor # ffmpeg path, GPU availability, default font
116
+ ```
117
+
118
+ From a checkout: `pip install -e .`
119
+
120
+ Dependencies are `skia-python`, `numpy` and `glfw`. Space Grotesk and IBM Plex Mono (both SIL Open Font License)
121
+ ship with the package, so default text looks the same on every machine.
122
+
123
+ ## Quick start
124
+
125
+ ```bash
126
+ kine new scene.json
127
+ kine check scene.json
128
+ kine look scene.json --boxes
129
+ kine render scene.json -o scene.mp4
130
+ ```
131
+
132
+ ```json
133
+ {
134
+ "canvas": {"w": 1920, "h": 1080, "fps": 30, "bg": "#0a0c10"},
135
+ "grade": {"vignette": 0.35, "grain": 0.04},
136
+ "layers": [
137
+ {"id": "dot", "type": "circle", "x": "50%", "y": "50%", "r": 26, "fill": "$accent",
138
+ "dur": 1.1, "enter": {"name": "pop", "dur": 0.4}, "exit": "fade"},
139
+ {"id": "title", "type": "text", "text": "Motion, **written.**", "x": "50%",
140
+ "y": "46%", "size": 140, "weight": 700, "split": "chars", "at": "dot.out-0.1",
141
+ "dur": 3.2, "enter": {"name": "snap", "stagger": 0.03}, "exit": "fade"},
142
+ {"id": "sub", "type": "text", "text": "scenes as data", "x": "50%", "y": "62%",
143
+ "size": 40, "fill": "$muted", "at": "title.in+0.6", "until": "title.out",
144
+ "enter": "rise"}
145
+ ]
146
+ }
147
+ ```
148
+
149
+ More scenes in [`examples/`](https://github.com/drknowhow/kinescript/tree/main/examples):
150
+
151
+ - [`hello.json`](https://github.com/drknowhow/kinescript/blob/main/examples/hello.json): a title animation, 4.2 s.
152
+ - [`edit.json`](https://github.com/drknowhow/kinescript/blob/main/examples/edit.json): a cut list with a
153
+ punch-in, a transition, a lower third, a callout, karaoke captions and a music bed, 10.4 s.
154
+ - [`3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/3d.json): a camera move past layers
155
+ at several depths and a card that turns over, 6 s.
156
+ - [`model.json`](https://github.com/drknowhow/kinescript/blob/main/examples/model.json): lit primitives and a
157
+ ring around a ball that builds in and flies apart, 6 s.
158
+ - [`title3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/title3d.json): the brand mark as an
159
+ extruded SVG path and the wordmark as extruded text, 5 s.
160
+ - [`import.json`](https://github.com/drknowhow/kinescript/blob/main/examples/import.json): a glTF rocket on a
161
+ ground shadow, 6 s.
162
+
163
+ `edit.json` and `import.json` read sample media: run `python examples/make_media.py` first to generate it.
164
+
165
+ ## Performance
166
+
167
+ Measured on the development machine (Intel Core Ultra 7 265, 20 threads, NVIDIA RTX 5060 Ti, Windows 11),
168
+ 2026-10-30:
169
+
170
+ | Workload | Result |
171
+ |---|---|
172
+ | Drawing one 1080p frame of the launch video on the GPU, converted to I420 and read back as a render does | median 2.7 ms, p95 3.3 ms (all 1038 frames) |
173
+ | Launch video, 34.6 s at 1080p30, `-q high`, with audio | 3.5 s wall, about 300 frames/s (median of 5 runs) |
174
+ | `examples/edit.json`, 10.4 s with two decoded video clips | 2.05 s wall, 152 frames/s (median of 5 runs) |
175
+
176
+ [`python bench/stages.py`](https://github.com/drknowhow/kinescript/blob/main/bench/stages.py) splits the time
177
+ per frame into drawing, conversion and readback, and writing to ffmpeg for several workloads, and times whole
178
+ renders.
179
+
180
+ Rendering uses Skia on the GPU through a hidden OpenGL context, one per worker process. Frames are split into
181
+ chunks, encoded in parallel and joined without re-encoding, while another ffmpeg process mixes the audio.
182
+ Within one process, such as the MCP server, the workers stay warm for two minutes between renders.
183
+
184
+ ## Limits
185
+
186
+ - Without a usable GPU, Kinescript falls back to Skia's CPU rasteriser. With the Windows `skia-python` wheel this is
187
+ very slow (about 0.65 s per 1080p frame for the launch video); use `--scale 0.5` for previews on such machines.
188
+ `KINE_BACKEND=cpu` forces this path.
189
+ - 3D is drawn by Skia with a depth sort, not a GL pipeline: models have no image textures, skeletal animation or
190
+ shadows cast on each other, and separate model layers do not hide each other per pixel (merge touching
191
+ objects as `parts` of one model). Draco- and meshopt-compressed model files are not read.
192
+ - Audio is mixing (trim, gain, fades, speed), not editing or effects.
193
+ - Video is decoded and resampled by ffmpeg to the scene frame rate. Jumping backwards or far ahead reopens the
194
+ decoder, which is slower than sequential playback.
195
+ - Text layout is single-script left-to-right with greedy wrapping. No shaping for complex scripts or bidi.
196
+ - Expressions are limited to arithmetic and the listed helpers; attribute access and other names are rejected.
197
+
198
+ ## Project layout
199
+
200
+ ```
201
+ kinescript/ engine: timing, props, scene, components, render (Skia), space, render3d,
202
+ mesh and models (3D), output (encoding and the audio mix),
203
+ verify (check, look, probe), schema, docs, mcp, cli
204
+ examples/ example scenes and the generator for sample media
205
+ marketing/ the launch video as a scene and its builder; build_site.py renders the site
206
+ site/ the project site: demo scenes next to the videos rendered from them
207
+ brand/ logo files, generated art and the brand guide
208
+ bench/ per-stage timing of frames and whole renders
209
+ content/ launch post and social copy
210
+ tests/ pytest suite
211
+ ```
212
+
213
+ ## License
214
+
215
+ MIT, see [`LICENSE`](https://github.com/drknowhow/kinescript/blob/main/LICENSE). The bundled fonts are under the
216
+ SIL Open Font License 1.1; their notices are in
217
+ [`kinescript/fonts/`](https://github.com/drknowhow/kinescript/tree/main/kinescript/fonts).
@@ -0,0 +1,13 @@
1
+ """Kinescript: motion graphics and video edits written as data, checked and rendered by agents."""
2
+ try:
3
+ import skia # noqa: F401
4
+ except ImportError as e: # on Linux the wheel loads the system's EGL and GL, even for the CPU backend
5
+ if ".so" not in str(e):
6
+ raise
7
+ raise ImportError(f"{e}. skia-python needs system libraries; on Debian or Ubuntu: "
8
+ "sudo apt install libegl1 libgl1 libfontconfig1") from e
9
+ from .output import render, still
10
+ from .scene import Scene, SceneError, load
11
+
12
+ __version__ = "1.1.1"
13
+ __all__ = ["Scene", "SceneError", "load", "render", "still", "__version__"]
@@ -215,8 +215,14 @@ def expand(raw, user: dict, theme: dict, scene=None):
215
215
  return out
216
216
 
217
217
 
218
- def _sequence(raw: dict) -> list[dict]:
219
- """Cut list -> back-to-back video layers. "transition": {"type": "fade", "dur": 0.4} overlaps them."""
218
+ _CLIP_KEYS = ("fit", "volume", "w", "h", "x", "y", "anchor")
219
+
220
+
221
+ def _sequence(raw: dict) -> dict:
222
+ """Cut list -> a group of back-to-back video layers, timed within the sequence. The group has the sequence's
223
+ id and ends with its last clip, so "cut.out" works as a cue. Its other layer keys (opacity, blur, fx, enter, ...)
224
+ apply to the whole cut; fit, volume, w, h, x, y and anchor go to each clip.
225
+ "transition": {"type": "fade", "dur": 0.4} overlaps the clips."""
220
226
  tr = raw.get("transition") or {}
221
227
  overlap = float(tr.get("dur", 0)) if tr else 0.0
222
228
  kind = tr.get("type", "fade") if tr else "none"
@@ -226,11 +232,11 @@ def _sequence(raw: dict) -> list[dict]:
226
232
  c = dict(clip) if isinstance(clip, dict) else {"src": clip}
227
233
  c.setdefault("type", "video")
228
234
  c.setdefault("id", f"{base}-{i + 1}")
229
- for k in ("fit", "volume", "w", "h", "x", "y", "anchor"):
235
+ for k in _CLIP_KEYS:
230
236
  if k in raw and k not in c:
231
237
  c[k] = raw[k]
232
238
  if i == 0:
233
- c.setdefault("at", raw.get("at", 0))
239
+ c.setdefault("at", 0)
234
240
  else:
235
241
  prev_id = out[-1]["id"]
236
242
  c.setdefault("at", f"{prev_id}.out-{overlap}" if overlap else f"{prev_id}.out")
@@ -239,7 +245,9 @@ def _sequence(raw: dict) -> list[dict]:
239
245
  "zoom": "zoom", "blur": "blur"}.get(kind, "fade"),
240
246
  "dur": overlap, "ease": "inOutSine", "dist": 120})
241
247
  out.append(c)
242
- return out
248
+ group = {k: v for k, v in raw.items() if k not in ("clips", "transition") + _CLIP_KEYS}
249
+ group.update(type="group", id=base, children=out, span=True)
250
+ return group
243
251
 
244
252
 
245
253
  def _ts(s: str) -> float:
@@ -87,7 +87,9 @@ KEYS EVERY LAYER HAS
87
87
  difference | color
88
88
  shadow {"x": 0, "y": 6, "blur": 16, "color": "#00000099"} (those are the defaults)
89
89
  fx {"brightness": 0, "contrast": 1, "saturate": 1, "hue": 0, "exposure": 0,
90
- "temperature": 0, "tint": 0, "gray": 0, "invert": 0}
90
+ "temperature": 0, "tint": 0, "gray": 0, "invert": 0}. brightness adds to every
91
+ channel (-1..1), so below 0 dark footage turns black; exposure is in stops and
92
+ multiplies (-1 halves the light), which is the way to darken footage.
91
93
  enter, exit a motion (see ENTER AND EXIT)
92
94
  hidden true skips the layer
93
95
  allowOffscreen true stops check warning when the layer leaves the canvas
@@ -105,8 +107,9 @@ LAYER TYPES (defaults in brackets)
105
107
  arrow x1 y1 x2 y2 bend [0] head [22] stroke strokeWidth
106
108
  text text (centred on x, y: the anchor is center), size [64], weight [600] (100..900), font ["Space Grotesk"; also "IBM Plex Mono",
107
109
  any installed family, or a .ttf path], italic, fill [#f2f0e8], emph (colour of
108
- words written **like this**), align [center] (left|center|right), maxWidth (wraps
109
- lines), lineHeight [1.18], letterSpacing [0], stroke, strokeWidth,
110
+ text written **like this**, also inside a word: g**P**u colours the P),
111
+ align [center] (left|center|right), maxWidth (wraps lines), lineHeight [1.18],
112
+ letterSpacing [0], stroke, strokeWidth,
110
113
  box {"fill": "#000000b0", "pad": [12, 20], "radius": 10} (a background behind the
111
114
  text; pad is [vertical, horizontal]), case (upper|lower),
112
115
  split (chars|words|lines: animate each unit, see ENTER AND EXIT),
@@ -135,9 +138,11 @@ LAYER TYPES (defaults in brackets)
135
138
  group children [layers], w, h, clip (true cuts children off at w x h), radius, fill.
136
139
  Children are placed from the group's x, y and start at the group's "at".
137
140
  sequence clips [{"src": "a.mp4", "trim": [0, 4]}, ...] and transition {"type": "fade",
138
- "dur": 0.4} (fade|wipe|slide|zoom|blur|cut). Becomes back-to-back video layers named
139
- <id>-1, <id>-2, ... Each transition overlaps the clips it joins, so 3 s + 3 s with a
140
- 0.5 s fade lasts 5.5 s.
141
+ "dur": 0.4} (fade|wipe|slide|zoom|blur|cut). Becomes a group of back-to-back video layers
142
+ named <id>-1, <id>-2, ... that ends with its last clip, so "<id>.out" is a cue. Each
143
+ transition overlaps the clips it joins, so 3 s + 3 s with a 0.5 s fade lasts 5.5 s.
144
+ fit, volume, w, h, x, y and anchor go to every clip; opacity, blur, fx, enter and the
145
+ other layer keys apply to the whole cut.
141
146
 
142
147
  DEPTH AND CAMERA (3D)
143
148
  Any layer can move and turn in depth. x is right, y is down and z is toward the viewer, in px,