kinescript 1.1.0__tar.gz → 1.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.
- kinescript-1.2.0/PKG-INFO +329 -0
- kinescript-1.2.0/README.md +282 -0
- kinescript-1.2.0/kinescript/__init__.py +13 -0
- kinescript-1.2.0/kinescript/audio.py +139 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/cli.py +17 -3
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/components.py +14 -6
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/docs.py +91 -17
- kinescript-1.2.0/kinescript/listen.py +349 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/mcp.py +22 -5
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/media.py +26 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/output.py +267 -32
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/render.py +41 -37
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/render3d.py +60 -17
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/scene.py +185 -14
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/schema.py +105 -19
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/timing.py +71 -17
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/verify.py +31 -7
- kinescript-1.2.0/kinescript/voice.py +204 -0
- kinescript-1.2.0/kinescript/words.py +115 -0
- kinescript-1.2.0/kinescript.egg-info/PKG-INFO +329 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript.egg-info/SOURCES.txt +5 -0
- kinescript-1.2.0/kinescript.egg-info/requires.txt +12 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/pyproject.toml +23 -5
- kinescript-1.2.0/tests/test_core.py +999 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/tests/test_docs.py +20 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/tests/test_models.py +15 -0
- kinescript-1.2.0/tests/test_packaging.py +160 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/tests/test_schema.py +34 -2
- kinescript-1.1.0/PKG-INFO +0 -192
- kinescript-1.1.0/README.md +0 -153
- kinescript-1.1.0/kinescript/__init__.py +0 -6
- kinescript-1.1.0/kinescript.egg-info/PKG-INFO +0 -192
- kinescript-1.1.0/kinescript.egg-info/requires.txt +0 -7
- kinescript-1.1.0/tests/test_core.py +0 -489
- {kinescript-1.1.0 → kinescript-1.2.0}/LICENSE +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/color.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/ease.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/IBMPlexMono-Bold.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/IBMPlexMono-Medium.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/IBMPlexMono-OFL.txt +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/IBMPlexMono-Regular.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/IBMPlexMono-SemiBold.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/SpaceGrotesk-Bold.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/SpaceGrotesk-Medium.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/SpaceGrotesk-OFL.txt +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/SpaceGrotesk-Regular.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/fonts/SpaceGrotesk-SemiBold.ttf +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/mesh.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/models.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/presets.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/props.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/shaders.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/space.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript/svgpath.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript.egg-info/dependency_links.txt +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript.egg-info/entry_points.txt +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/kinescript.egg-info/top_level.txt +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/setup.cfg +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/tests/test_color_pipeline.py +0 -0
- {kinescript-1.1.0 → kinescript-1.2.0}/tests/test_motion_blur.py +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kinescript
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Render motion graphics, video edits and voice-over 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,voice-over,text to speech,audio mixing,loudness,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 :: Sound/Audio :: Mixers
|
|
29
|
+
Classifier: Topic :: Multimedia :: Video
|
|
30
|
+
Classifier: Topic :: Multimedia :: Video :: Conversion
|
|
31
|
+
Classifier: Topic :: Multimedia :: Video :: Non-Linear Editor
|
|
32
|
+
Requires-Python: >=3.10
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
License-File: kinescript/fonts/IBMPlexMono-OFL.txt
|
|
36
|
+
License-File: kinescript/fonts/SpaceGrotesk-OFL.txt
|
|
37
|
+
Requires-Dist: skia-python>=87
|
|
38
|
+
Requires-Dist: numpy>=1.24
|
|
39
|
+
Requires-Dist: glfw>=2.5
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
42
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
43
|
+
Requires-Dist: readme_renderer[md]>=43; extra == "dev"
|
|
44
|
+
Requires-Dist: trove-classifiers; extra == "dev"
|
|
45
|
+
Requires-Dist: tomli>=2; python_version < "3.11" and extra == "dev"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
<p align="center"><img src="https://raw.githubusercontent.com/drknowhow/kinescript/main/brand/logo-dark.png" width="460" alt="kinescript"></p>
|
|
49
|
+
|
|
50
|
+
<p align="center"><b>Video you can diff.</b><br>Motion graphics, video edits and voice-over written as JSON, checked by agents, rendered on the GPU.</p>
|
|
51
|
+
|
|
52
|
+
<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>
|
|
53
|
+
|
|
54
|
+
<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>
|
|
55
|
+
|
|
56
|
+
Kinescript turns a JSON scene into video. Every layer, keyframe, cut and sound is a line of data, so a scene can
|
|
57
|
+
be generated, reviewed in a pull request, and changed by a script or an agent. A voice-over can start as a line of
|
|
58
|
+
text. The renderer is a pure function of the frame number: any frame renders on its own, which makes previews
|
|
59
|
+
instant and lets a render split across processes.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install kinescript
|
|
63
|
+
kine doctor
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
It needs Python 3.10 or newer and ffmpeg on your `PATH` ([details](https://github.com/drknowhow/kinescript#install)).
|
|
67
|
+
|
|
68
|
+
The [launch video](https://github.com/drknowhow/kinescript/blob/main/docs/promo.mp4) is a Kinescript scene,
|
|
69
|
+
[`marketing/promo.json`](https://github.com/drknowhow/kinescript/blob/main/marketing/promo.json). It is 35
|
|
70
|
+
seconds of 1080p and renders, with audio, in about 3.3 seconds on the development machine. The
|
|
71
|
+
[project site](https://drknowhow.github.io/kinescript/) shows more demos, each next to the scene file it was
|
|
72
|
+
rendered from.
|
|
73
|
+
|
|
74
|
+
## What it does
|
|
75
|
+
|
|
76
|
+
- **Cue timing.** Start and end times can name other layers: `"at": "title.out+0.2"`. Lengthen one layer and
|
|
77
|
+
everything cued after it moves. Cycles and missing references are reported with the ids involved.
|
|
78
|
+
- **Animate anything.** Numbers and colours take constants, keyframes (`[[0, 0], [0.6, 1, "outBack"]]`, with
|
|
79
|
+
negative times counted from the layer's end), a tween object, or an expression such as `"=540 + sin(t*3)*40"`.
|
|
80
|
+
Colours interpolate in OKLab.
|
|
81
|
+
- **Text that moves per letter.** `"split": "chars"` (or words, or lines) with a staggered enter motion, a
|
|
82
|
+
typewriter reveal with a caret, `**emphasis**` markup, and per-unit expressions (`"unitY": "=sin(T*4 + i)*12"`
|
|
83
|
+
for a wave).
|
|
84
|
+
- **Footage.** Video layers with trim, speed, loop, cover/contain fit, punch-in `zoom` around a `focus` point, and
|
|
85
|
+
rounded picture-in-picture. A `sequence` turns a cut list into clips with fade, wipe, slide, zoom or blur
|
|
86
|
+
transitions. Clip audio and music beds are mixed automatically.
|
|
87
|
+
- **Sound on the same timeline.** Voice-over, music and effects are cues like layers, a voice's words are cues
|
|
88
|
+
too, a voice can be spoken from text, and sounds with a role are levelled and ducked for you
|
|
89
|
+
([Sound](https://github.com/drknowhow/kinescript#sound)).
|
|
90
|
+
- **Captions** from `.srt`/`.vtt`, inline cues or a voice's word times, with karaoke and pop modes.
|
|
91
|
+
- **Shaders.** SkSL layers with `mesh`, `aurora`, `grid` and `score` presets, or your own source.
|
|
92
|
+
- **Finishing.** Per-layer blur, shadow, blend modes and colour adjustments; a scene grade with vignette and film
|
|
93
|
+
grain; optional motion blur.
|
|
94
|
+
- **Components.** `lowerThird`, `titleCard`, `callout`, `focus` (dim everything but a region), `progress`,
|
|
95
|
+
`kinetic`, plus your own with `{{param}}` placeholders.
|
|
96
|
+
- **Outputs.** H.264 `.mp4`, ProRes 4444 `.mov` and VP9 `.webm` with alpha for compositing, `.gif`, PNG sequences.
|
|
97
|
+
|
|
98
|
+
## 3D
|
|
99
|
+
|
|
100
|
+
Depth and models are drawn by the same Skia renderer as everything else, with no extra dependency. Scenes that use
|
|
101
|
+
no depth draw exactly as before.
|
|
102
|
+
|
|
103
|
+
- **Camera and depth on any layer.** Every layer takes `z`, `rotateX`, `rotateY` and `backface`. A top-level
|
|
104
|
+
`camera` pans, dollies, orbits and rolls with perspective; `fixed` layers ignore its moves, and a group with
|
|
105
|
+
`"sort": "depth"` draws its children far to near. The `flip`, `flip-up`, `tumble` and `push` motions work on
|
|
106
|
+
whole layers and per letter with `split`. A two-sided card is a group with `"backface": "hidden"` on each side.
|
|
107
|
+
- **Model layers.** `"type": "model"` draws a lit `cube`, `sphere`, `cylinder`, `cone`, `torus` or `plane`, or
|
|
108
|
+
several shapes merged as `parts` so their triangles are depth-sorted together. Materials take `fill`, `shine`,
|
|
109
|
+
`metal`, `rim` and `bands` (toon steps). `light`, for the scene or one model, takes `studio`, `soft`,
|
|
110
|
+
`dramatic` or `flat`, or your own amounts. `explode` sends faces outward and the `build` motion assembles a model.
|
|
111
|
+
- **Extruded text and SVG paths.** `"shape": "text"` extrudes letters in any font and `"shape": "path"` extrudes
|
|
112
|
+
SVG path data, filled, or stroked with `strokeWidth` for line icons. Both take a `depth` and a 45-degree `bevel`.
|
|
113
|
+
- **Model files.** `src` reads `.glb` and `.gltf` (glTF 2.0) and `.obj` with its `.mtl`: node transforms, base
|
|
114
|
+
colours, and metallic and roughness as `metal` and `shine`. `ground` puts a soft shadow under any model.
|
|
115
|
+
|
|
116
|
+
A 3D title that builds in and turns to face the camera:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{"id": "title3d", "type": "model", "shape": "text", "text": "LAUNCH",
|
|
120
|
+
"x": "50%", "y": "50%", "size": 240, "weight": 800, "depth": 70, "bevel": 5,
|
|
121
|
+
"rotateY": [[0, -40], [2.4, 0, "outCubic"]], "rotateX": [[0, 18], [2.4, 0, "outCubic"]],
|
|
122
|
+
"shine": 0.6, "enter": {"name": "build", "dur": 1.2}}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Sound
|
|
126
|
+
|
|
127
|
+
Sounds are a top-level `audio` list, timed like layers and mixed by ffmpeg while the frames render.
|
|
128
|
+
|
|
129
|
+
- **Cues both ways.** `"at": "vo1.out+0.3"` starts a layer 0.3 s after the voice ends, and a sound can start at
|
|
130
|
+
`"title.in"`. A layer's `"sound": "pop.wav"` plays when it appears and moves when it moves. A voice stretches an
|
|
131
|
+
`auto` duration so it is never cut off.
|
|
132
|
+
- **Words are cues.** A words file next to a voice (`vo1.words.json`, or Whisper's JSON as it is) times each
|
|
133
|
+
word: `"at": "vo1:render"` starts a layer as the voice says "render", and `{"type": "captions", "voice": "vo1"}`
|
|
134
|
+
captions it, lighting each word as it is said.
|
|
135
|
+
- **Voice-over from text.** Write what a voice says in `text` and `kine voice` speaks it through a plugin, writing
|
|
136
|
+
the file and its word times. [Kokoro](https://github.com/drknowhow/kinescript/tree/main/plugins/kinescript-kokoro)
|
|
137
|
+
is the first. `[[go]]` in the text names the next word, so a cue to `vo1:go` survives a rewrite of the line.
|
|
138
|
+
Only a line whose text, speaker or rate changed is spoken again, and rendering never calls a speech engine.
|
|
139
|
+
- **A mix without listening.** Give a sound a `role` and it is set to that role's level: voice -18 LUFS, music
|
|
140
|
+
-16, ambience -30, effects peaking at -6 dBFS. Music and ambience dip 14 dB while a voice speaks, an effect's
|
|
141
|
+
leading silence is skipped so it lands on its cue, and the whole mix ends at -16 LUFS with peaks under
|
|
142
|
+
-1.5 dBTP. A top-level `mix` changes the targets. Sounds without a role are mixed as given.
|
|
143
|
+
- **Checked and drawn.** `kine check` mixes and measures the sound and reports a voice cut off or masked by the
|
|
144
|
+
music, an effect that lands late, silence, and a mix off its targets. `kine look --audio` draws the sound under
|
|
145
|
+
the frames on the same time axis.
|
|
146
|
+
- **Everywhere.** Gain takes keyframes and expressions like any property; sounds loop and pan; the mix goes into
|
|
147
|
+
MP4, MOV, WebM and `--from/--to` renders, and `-o mix.wav` renders the sound alone.
|
|
148
|
+
|
|
149
|
+
A narrated beat with a click on a marked word, over music that ducks under the voice:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
"audio": [
|
|
153
|
+
{"id": "vo", "role": "voice", "at": 0.6, "text": "Each word it says is a [[hit]]cue."},
|
|
154
|
+
{"id": "bed", "role": "music", "src": "bed.m4a", "loop": true, "until": "end", "fadeOut": 1.5}
|
|
155
|
+
],
|
|
156
|
+
"layers": [
|
|
157
|
+
{"id": "cue", "type": "text", "text": "Cue", "size": 200, "at": "vo:hit", "sound": "click.wav", "enter": "pop"},
|
|
158
|
+
{"id": "cc", "type": "captions", "voice": "vo", "mode": "karaoke"}
|
|
159
|
+
]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`kine voice scene.json` speaks it once. The
|
|
163
|
+
[voice demo](https://drknowhow.github.io/kinescript/#sound) on the project site plays the result with sound, next
|
|
164
|
+
to its scene file. The Kokoro plugin needs Python 3.10 to 3.12:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
pip install "kinescript-kokoro @ git+https://github.com/drknowhow/kinescript#subdirectory=plugins/kinescript-kokoro"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
On a newer Python, install it into another one and point `KINE_VOICE_CMD` at it
|
|
171
|
+
([details](https://github.com/drknowhow/kinescript/tree/main/plugins/kinescript-kokoro)).
|
|
172
|
+
|
|
173
|
+
## Built for agents
|
|
174
|
+
|
|
175
|
+
An agent cannot watch a video, so Kinescript gives it things it can read:
|
|
176
|
+
|
|
177
|
+
| Command | What the agent gets |
|
|
178
|
+
|---|---|
|
|
179
|
+
| `kine docs` | the full scene reference, short enough to keep in context |
|
|
180
|
+
| `kine check scene.json` | every problem at once as JSON, each with its layer, time range and a fix |
|
|
181
|
+
| `kine look scene.json --boxes` | one PNG of many labelled frames, with every layer outlined and the top-level ones named |
|
|
182
|
+
| `kine look scene.json --audio` | the same frames with the sound under them: a lane per role and the mix, the duck and issues, plus each sound's measured loudness |
|
|
183
|
+
| `kine probe scene.json --at 3.2` | resolved in/out of every layer and each visible layer's screen box |
|
|
184
|
+
| `kine still` / `kine render` | a frame, a range (`--from/--to`), a draft (`-q draft --scale 0.5`) or the final file |
|
|
185
|
+
| `kine watch scene.json` | the contact sheet, made again every time the file is saved |
|
|
186
|
+
| `kine voice scene.json` | each sound with text spoken into its file, with its word times, skipping what has not changed |
|
|
187
|
+
|
|
188
|
+
`kine check` reports unknown keys and bad values, missing media and out-of-range trims, text off the canvas or
|
|
189
|
+
in the safe margin, overlapping text, contrast under 3:1 against what is actually behind the text, tiny text and
|
|
190
|
+
too little reading time. When the scene has sound it mixes and measures it, without drawing a frame, while the
|
|
191
|
+
frames are checked, and reports a voice cut off by the scene end, two voices at once, music less than 10 LU under a
|
|
192
|
+
voice, an effect whose first sound comes late, a silent sound, and a mix off its loudness target or at its peak
|
|
193
|
+
ceiling. An unknown key names the intended key first. Common names from other tools (`color`,
|
|
194
|
+
`fontSize`, `duration`, `position`) are read and reported as info notes. It exits with status 1 while there are
|
|
195
|
+
errors.
|
|
196
|
+
|
|
197
|
+
The same tools are available over MCP (`kine mcp`) as `kine_docs`, `kine_check`, `kine_look`, `kine_still`,
|
|
198
|
+
`kine_probe`, `kine_render` and `kine_voice`. They take a scene as a file path or as the JSON object itself, and `kine_look`
|
|
199
|
+
and `kine_still` return images inline.
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"mcpServers": {
|
|
204
|
+
"kinescript": {"command": "kine", "args": ["mcp"]}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Install
|
|
210
|
+
|
|
211
|
+
Requires Python 3.10+ and ffmpeg on `PATH` (for example `winget install Gyan.FFmpeg`, `brew install ffmpeg` or
|
|
212
|
+
`sudo apt install ffmpeg`). On Linux, `skia-python` also loads the system's EGL, GL and fontconfig libraries, even
|
|
213
|
+
with `KINE_BACKEND=cpu`. A bare container or server needs `sudo apt install libegl1 libgl1 libfontconfig1`, or
|
|
214
|
+
importing Kinescript fails with `libEGL.so.1: cannot open shared object file`.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
pip install kinescript
|
|
218
|
+
kine doctor # ffmpeg path, GPU availability, default font
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
From a checkout: `pip install -e .`
|
|
222
|
+
|
|
223
|
+
Dependencies are `skia-python`, `numpy` and `glfw`. Space Grotesk and IBM Plex Mono (both SIL Open Font License)
|
|
224
|
+
ship with the package, so default text looks the same on every machine.
|
|
225
|
+
|
|
226
|
+
## Quick start
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
kine new scene.json
|
|
230
|
+
kine check scene.json
|
|
231
|
+
kine look scene.json --boxes
|
|
232
|
+
kine render scene.json -o scene.mp4
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"canvas": {"w": 1920, "h": 1080, "fps": 30, "bg": "#0a0c10"},
|
|
238
|
+
"grade": {"vignette": 0.35, "grain": 0.04},
|
|
239
|
+
"layers": [
|
|
240
|
+
{"id": "dot", "type": "circle", "x": "50%", "y": "50%", "r": 26, "fill": "$accent",
|
|
241
|
+
"dur": 1.1, "enter": {"name": "pop", "dur": 0.4}, "exit": "fade"},
|
|
242
|
+
{"id": "title", "type": "text", "text": "Motion, **written.**", "x": "50%",
|
|
243
|
+
"y": "46%", "size": 140, "weight": 700, "split": "chars", "at": "dot.out-0.1",
|
|
244
|
+
"dur": 3.2, "enter": {"name": "snap", "stagger": 0.03}, "exit": "fade"},
|
|
245
|
+
{"id": "sub", "type": "text", "text": "scenes as data", "x": "50%", "y": "62%",
|
|
246
|
+
"size": 40, "fill": "$muted", "at": "title.in+0.6", "until": "title.out",
|
|
247
|
+
"enter": "rise"}
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
More scenes in [`examples/`](https://github.com/drknowhow/kinescript/tree/main/examples):
|
|
253
|
+
|
|
254
|
+
- [`hello.json`](https://github.com/drknowhow/kinescript/blob/main/examples/hello.json): a title animation, 4.2 s.
|
|
255
|
+
- [`edit.json`](https://github.com/drknowhow/kinescript/blob/main/examples/edit.json): a cut list with a
|
|
256
|
+
punch-in, a transition, a lower third, a callout, karaoke captions and a music bed, 10.4 s.
|
|
257
|
+
- [`3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/3d.json): a camera move past layers
|
|
258
|
+
at several depths and a card that turns over, 6 s.
|
|
259
|
+
- [`model.json`](https://github.com/drknowhow/kinescript/blob/main/examples/model.json): lit primitives and a
|
|
260
|
+
ring around a ball that builds in and flies apart, 6 s.
|
|
261
|
+
- [`title3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/title3d.json): the brand mark as an
|
|
262
|
+
extruded SVG path and the wordmark as extruded text, 5 s.
|
|
263
|
+
- [`import.json`](https://github.com/drknowhow/kinescript/blob/main/examples/import.json): a glTF rocket on a
|
|
264
|
+
ground shadow, 6 s.
|
|
265
|
+
- [`voiceover.json`](https://github.com/drknowhow/kinescript/blob/main/examples/voiceover.json): titles cued from
|
|
266
|
+
the words of a voice-over, karaoke captions of it, and a music bed that dips under it, 5.4 s.
|
|
267
|
+
- [`narrated.json`](https://github.com/drknowhow/kinescript/blob/main/examples/narrated.json): the same idea
|
|
268
|
+
with a voice written as text, a marked word and a click on it. Run `kine voice examples/narrated.json` first.
|
|
269
|
+
|
|
270
|
+
`edit.json`, `import.json`, `voiceover.json` and `narrated.json` read sample media: run
|
|
271
|
+
`python examples/make_media.py` first to generate it.
|
|
272
|
+
|
|
273
|
+
## Performance
|
|
274
|
+
|
|
275
|
+
Measured on the development machine (Intel Core Ultra 7 265, 20 threads, NVIDIA RTX 5060 Ti, Windows 11),
|
|
276
|
+
2026-10-30:
|
|
277
|
+
|
|
278
|
+
| Workload | Result |
|
|
279
|
+
|---|---|
|
|
280
|
+
| Drawing one 1080p frame of the launch video on the GPU, converted to I420 and read back as a render does | median 2.8 ms, p95 3.8 ms (all 1038 frames) |
|
|
281
|
+
| Launch video, 34.6 s at 1080p30, `-q high`, with audio | 3.3 s wall, about 320 frames/s (median of 5 runs) |
|
|
282
|
+
| `examples/edit.json`, 10.4 s with two decoded video clips | 2.25 s wall, 139 frames/s (median of 5 runs) |
|
|
283
|
+
|
|
284
|
+
[`python bench/stages.py`](https://github.com/drknowhow/kinescript/blob/main/bench/stages.py) splits the time
|
|
285
|
+
per frame into drawing, conversion and readback, and writing to ffmpeg for several workloads, and times whole
|
|
286
|
+
renders.
|
|
287
|
+
|
|
288
|
+
Rendering uses Skia on the GPU through a hidden OpenGL context, one per worker process. Frames are split into
|
|
289
|
+
chunks, encoded in parallel and joined without re-encoding, while another ffmpeg process mixes the audio.
|
|
290
|
+
Within one process, such as the MCP server, the workers stay warm for two minutes between renders.
|
|
291
|
+
|
|
292
|
+
## Limits
|
|
293
|
+
|
|
294
|
+
- Without a usable GPU, Kinescript falls back to Skia's CPU rasteriser. With the Windows `skia-python` wheel this is
|
|
295
|
+
very slow (about 0.65 s per 1080p frame for the launch video); use `--scale 0.5` for previews on such machines.
|
|
296
|
+
`KINE_BACKEND=cpu` forces this path.
|
|
297
|
+
- 3D is drawn by Skia with a depth sort, not a GL pipeline: models have no image textures, skeletal animation or
|
|
298
|
+
shadows cast on each other, and separate model layers do not hide each other per pixel (merge touching
|
|
299
|
+
objects as `parts` of one model). Draco- and meshopt-compressed model files are not read.
|
|
300
|
+
- Audio is mixing and levelling (trim, gain over time, fades, speed, loop, pan, role levels, ducking, a loudness
|
|
301
|
+
target), with no effects such as EQ, compression of single sounds or reverb.
|
|
302
|
+
- Kinescript does not speak by itself: `kine voice` needs a plugin or a command. The Kokoro plugin times words
|
|
303
|
+
for English voices only and needs Python 3.10 to 3.12.
|
|
304
|
+
- Video is decoded and resampled by ffmpeg to the scene frame rate. Jumping backwards or far ahead reopens the
|
|
305
|
+
decoder, which is slower than sequential playback.
|
|
306
|
+
- Text layout is single-script left-to-right with greedy wrapping. No shaping for complex scripts or bidi.
|
|
307
|
+
- Expressions are limited to arithmetic and the listed helpers; attribute access and other names are rejected.
|
|
308
|
+
|
|
309
|
+
## Project layout
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
kinescript/ engine: timing, props, scene, components, render (Skia), space, render3d,
|
|
313
|
+
mesh and models (3D), output (encoding and the audio mix),
|
|
314
|
+
verify (check, look, probe), schema, docs, mcp, cli
|
|
315
|
+
examples/ example scenes and the generator for sample media
|
|
316
|
+
plugins/ kinescript-kokoro, the Kokoro voice for kine voice (installed on its own)
|
|
317
|
+
marketing/ the launch video as a scene and its builder; build_site.py renders the site
|
|
318
|
+
site/ the project site: demo scenes next to the videos rendered from them
|
|
319
|
+
brand/ logo files, generated art and the brand guide
|
|
320
|
+
bench/ per-stage timing of frames and whole renders
|
|
321
|
+
content/ launch post and social copy
|
|
322
|
+
tests/ pytest suite
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## License
|
|
326
|
+
|
|
327
|
+
MIT, see [`LICENSE`](https://github.com/drknowhow/kinescript/blob/main/LICENSE). The bundled fonts are under the
|
|
328
|
+
SIL Open Font License 1.1; their notices are in
|
|
329
|
+
[`kinescript/fonts/`](https://github.com/drknowhow/kinescript/tree/main/kinescript/fonts).
|
|
@@ -0,0 +1,282 @@
|
|
|
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, video edits and voice-over 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, cut and sound is a line of data, so a scene can
|
|
10
|
+
be generated, reviewed in a pull request, and changed by a script or an agent. A voice-over can start as a line of
|
|
11
|
+
text. The renderer is a pure function of the frame number: any frame renders on its own, which makes previews
|
|
12
|
+
instant and lets a render split across 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.3 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
|
+
- **Sound on the same timeline.** Voice-over, music and effects are cues like layers, a voice's words are cues
|
|
41
|
+
too, a voice can be spoken from text, and sounds with a role are levelled and ducked for you
|
|
42
|
+
([Sound](https://github.com/drknowhow/kinescript#sound)).
|
|
43
|
+
- **Captions** from `.srt`/`.vtt`, inline cues or a voice's word times, with karaoke and pop modes.
|
|
44
|
+
- **Shaders.** SkSL layers with `mesh`, `aurora`, `grid` and `score` presets, or your own source.
|
|
45
|
+
- **Finishing.** Per-layer blur, shadow, blend modes and colour adjustments; a scene grade with vignette and film
|
|
46
|
+
grain; optional motion blur.
|
|
47
|
+
- **Components.** `lowerThird`, `titleCard`, `callout`, `focus` (dim everything but a region), `progress`,
|
|
48
|
+
`kinetic`, plus your own with `{{param}}` placeholders.
|
|
49
|
+
- **Outputs.** H.264 `.mp4`, ProRes 4444 `.mov` and VP9 `.webm` with alpha for compositing, `.gif`, PNG sequences.
|
|
50
|
+
|
|
51
|
+
## 3D
|
|
52
|
+
|
|
53
|
+
Depth and models are drawn by the same Skia renderer as everything else, with no extra dependency. Scenes that use
|
|
54
|
+
no depth draw exactly as before.
|
|
55
|
+
|
|
56
|
+
- **Camera and depth on any layer.** Every layer takes `z`, `rotateX`, `rotateY` and `backface`. A top-level
|
|
57
|
+
`camera` pans, dollies, orbits and rolls with perspective; `fixed` layers ignore its moves, and a group with
|
|
58
|
+
`"sort": "depth"` draws its children far to near. The `flip`, `flip-up`, `tumble` and `push` motions work on
|
|
59
|
+
whole layers and per letter with `split`. A two-sided card is a group with `"backface": "hidden"` on each side.
|
|
60
|
+
- **Model layers.** `"type": "model"` draws a lit `cube`, `sphere`, `cylinder`, `cone`, `torus` or `plane`, or
|
|
61
|
+
several shapes merged as `parts` so their triangles are depth-sorted together. Materials take `fill`, `shine`,
|
|
62
|
+
`metal`, `rim` and `bands` (toon steps). `light`, for the scene or one model, takes `studio`, `soft`,
|
|
63
|
+
`dramatic` or `flat`, or your own amounts. `explode` sends faces outward and the `build` motion assembles a model.
|
|
64
|
+
- **Extruded text and SVG paths.** `"shape": "text"` extrudes letters in any font and `"shape": "path"` extrudes
|
|
65
|
+
SVG path data, filled, or stroked with `strokeWidth` for line icons. Both take a `depth` and a 45-degree `bevel`.
|
|
66
|
+
- **Model files.** `src` reads `.glb` and `.gltf` (glTF 2.0) and `.obj` with its `.mtl`: node transforms, base
|
|
67
|
+
colours, and metallic and roughness as `metal` and `shine`. `ground` puts a soft shadow under any model.
|
|
68
|
+
|
|
69
|
+
A 3D title that builds in and turns to face the camera:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{"id": "title3d", "type": "model", "shape": "text", "text": "LAUNCH",
|
|
73
|
+
"x": "50%", "y": "50%", "size": 240, "weight": 800, "depth": 70, "bevel": 5,
|
|
74
|
+
"rotateY": [[0, -40], [2.4, 0, "outCubic"]], "rotateX": [[0, 18], [2.4, 0, "outCubic"]],
|
|
75
|
+
"shine": 0.6, "enter": {"name": "build", "dur": 1.2}}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Sound
|
|
79
|
+
|
|
80
|
+
Sounds are a top-level `audio` list, timed like layers and mixed by ffmpeg while the frames render.
|
|
81
|
+
|
|
82
|
+
- **Cues both ways.** `"at": "vo1.out+0.3"` starts a layer 0.3 s after the voice ends, and a sound can start at
|
|
83
|
+
`"title.in"`. A layer's `"sound": "pop.wav"` plays when it appears and moves when it moves. A voice stretches an
|
|
84
|
+
`auto` duration so it is never cut off.
|
|
85
|
+
- **Words are cues.** A words file next to a voice (`vo1.words.json`, or Whisper's JSON as it is) times each
|
|
86
|
+
word: `"at": "vo1:render"` starts a layer as the voice says "render", and `{"type": "captions", "voice": "vo1"}`
|
|
87
|
+
captions it, lighting each word as it is said.
|
|
88
|
+
- **Voice-over from text.** Write what a voice says in `text` and `kine voice` speaks it through a plugin, writing
|
|
89
|
+
the file and its word times. [Kokoro](https://github.com/drknowhow/kinescript/tree/main/plugins/kinescript-kokoro)
|
|
90
|
+
is the first. `[[go]]` in the text names the next word, so a cue to `vo1:go` survives a rewrite of the line.
|
|
91
|
+
Only a line whose text, speaker or rate changed is spoken again, and rendering never calls a speech engine.
|
|
92
|
+
- **A mix without listening.** Give a sound a `role` and it is set to that role's level: voice -18 LUFS, music
|
|
93
|
+
-16, ambience -30, effects peaking at -6 dBFS. Music and ambience dip 14 dB while a voice speaks, an effect's
|
|
94
|
+
leading silence is skipped so it lands on its cue, and the whole mix ends at -16 LUFS with peaks under
|
|
95
|
+
-1.5 dBTP. A top-level `mix` changes the targets. Sounds without a role are mixed as given.
|
|
96
|
+
- **Checked and drawn.** `kine check` mixes and measures the sound and reports a voice cut off or masked by the
|
|
97
|
+
music, an effect that lands late, silence, and a mix off its targets. `kine look --audio` draws the sound under
|
|
98
|
+
the frames on the same time axis.
|
|
99
|
+
- **Everywhere.** Gain takes keyframes and expressions like any property; sounds loop and pan; the mix goes into
|
|
100
|
+
MP4, MOV, WebM and `--from/--to` renders, and `-o mix.wav` renders the sound alone.
|
|
101
|
+
|
|
102
|
+
A narrated beat with a click on a marked word, over music that ducks under the voice:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
"audio": [
|
|
106
|
+
{"id": "vo", "role": "voice", "at": 0.6, "text": "Each word it says is a [[hit]]cue."},
|
|
107
|
+
{"id": "bed", "role": "music", "src": "bed.m4a", "loop": true, "until": "end", "fadeOut": 1.5}
|
|
108
|
+
],
|
|
109
|
+
"layers": [
|
|
110
|
+
{"id": "cue", "type": "text", "text": "Cue", "size": 200, "at": "vo:hit", "sound": "click.wav", "enter": "pop"},
|
|
111
|
+
{"id": "cc", "type": "captions", "voice": "vo", "mode": "karaoke"}
|
|
112
|
+
]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`kine voice scene.json` speaks it once. The
|
|
116
|
+
[voice demo](https://drknowhow.github.io/kinescript/#sound) on the project site plays the result with sound, next
|
|
117
|
+
to its scene file. The Kokoro plugin needs Python 3.10 to 3.12:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pip install "kinescript-kokoro @ git+https://github.com/drknowhow/kinescript#subdirectory=plugins/kinescript-kokoro"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
On a newer Python, install it into another one and point `KINE_VOICE_CMD` at it
|
|
124
|
+
([details](https://github.com/drknowhow/kinescript/tree/main/plugins/kinescript-kokoro)).
|
|
125
|
+
|
|
126
|
+
## Built for agents
|
|
127
|
+
|
|
128
|
+
An agent cannot watch a video, so Kinescript gives it things it can read:
|
|
129
|
+
|
|
130
|
+
| Command | What the agent gets |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `kine docs` | the full scene reference, short enough to keep in context |
|
|
133
|
+
| `kine check scene.json` | every problem at once as JSON, each with its layer, time range and a fix |
|
|
134
|
+
| `kine look scene.json --boxes` | one PNG of many labelled frames, with every layer outlined and the top-level ones named |
|
|
135
|
+
| `kine look scene.json --audio` | the same frames with the sound under them: a lane per role and the mix, the duck and issues, plus each sound's measured loudness |
|
|
136
|
+
| `kine probe scene.json --at 3.2` | resolved in/out of every layer and each visible layer's screen box |
|
|
137
|
+
| `kine still` / `kine render` | a frame, a range (`--from/--to`), a draft (`-q draft --scale 0.5`) or the final file |
|
|
138
|
+
| `kine watch scene.json` | the contact sheet, made again every time the file is saved |
|
|
139
|
+
| `kine voice scene.json` | each sound with text spoken into its file, with its word times, skipping what has not changed |
|
|
140
|
+
|
|
141
|
+
`kine check` reports unknown keys and bad values, missing media and out-of-range trims, text off the canvas or
|
|
142
|
+
in the safe margin, overlapping text, contrast under 3:1 against what is actually behind the text, tiny text and
|
|
143
|
+
too little reading time. When the scene has sound it mixes and measures it, without drawing a frame, while the
|
|
144
|
+
frames are checked, and reports a voice cut off by the scene end, two voices at once, music less than 10 LU under a
|
|
145
|
+
voice, an effect whose first sound comes late, a silent sound, and a mix off its loudness target or at its peak
|
|
146
|
+
ceiling. An unknown key names the intended key first. Common names from other tools (`color`,
|
|
147
|
+
`fontSize`, `duration`, `position`) are read and reported as info notes. It exits with status 1 while there are
|
|
148
|
+
errors.
|
|
149
|
+
|
|
150
|
+
The same tools are available over MCP (`kine mcp`) as `kine_docs`, `kine_check`, `kine_look`, `kine_still`,
|
|
151
|
+
`kine_probe`, `kine_render` and `kine_voice`. They take a scene as a file path or as the JSON object itself, and `kine_look`
|
|
152
|
+
and `kine_still` return images inline.
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"mcpServers": {
|
|
157
|
+
"kinescript": {"command": "kine", "args": ["mcp"]}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Install
|
|
163
|
+
|
|
164
|
+
Requires Python 3.10+ and ffmpeg on `PATH` (for example `winget install Gyan.FFmpeg`, `brew install ffmpeg` or
|
|
165
|
+
`sudo apt install ffmpeg`). On Linux, `skia-python` also loads the system's EGL, GL and fontconfig libraries, even
|
|
166
|
+
with `KINE_BACKEND=cpu`. A bare container or server needs `sudo apt install libegl1 libgl1 libfontconfig1`, or
|
|
167
|
+
importing Kinescript fails with `libEGL.so.1: cannot open shared object file`.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
pip install kinescript
|
|
171
|
+
kine doctor # ffmpeg path, GPU availability, default font
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
From a checkout: `pip install -e .`
|
|
175
|
+
|
|
176
|
+
Dependencies are `skia-python`, `numpy` and `glfw`. Space Grotesk and IBM Plex Mono (both SIL Open Font License)
|
|
177
|
+
ship with the package, so default text looks the same on every machine.
|
|
178
|
+
|
|
179
|
+
## Quick start
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
kine new scene.json
|
|
183
|
+
kine check scene.json
|
|
184
|
+
kine look scene.json --boxes
|
|
185
|
+
kine render scene.json -o scene.mp4
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"canvas": {"w": 1920, "h": 1080, "fps": 30, "bg": "#0a0c10"},
|
|
191
|
+
"grade": {"vignette": 0.35, "grain": 0.04},
|
|
192
|
+
"layers": [
|
|
193
|
+
{"id": "dot", "type": "circle", "x": "50%", "y": "50%", "r": 26, "fill": "$accent",
|
|
194
|
+
"dur": 1.1, "enter": {"name": "pop", "dur": 0.4}, "exit": "fade"},
|
|
195
|
+
{"id": "title", "type": "text", "text": "Motion, **written.**", "x": "50%",
|
|
196
|
+
"y": "46%", "size": 140, "weight": 700, "split": "chars", "at": "dot.out-0.1",
|
|
197
|
+
"dur": 3.2, "enter": {"name": "snap", "stagger": 0.03}, "exit": "fade"},
|
|
198
|
+
{"id": "sub", "type": "text", "text": "scenes as data", "x": "50%", "y": "62%",
|
|
199
|
+
"size": 40, "fill": "$muted", "at": "title.in+0.6", "until": "title.out",
|
|
200
|
+
"enter": "rise"}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
More scenes in [`examples/`](https://github.com/drknowhow/kinescript/tree/main/examples):
|
|
206
|
+
|
|
207
|
+
- [`hello.json`](https://github.com/drknowhow/kinescript/blob/main/examples/hello.json): a title animation, 4.2 s.
|
|
208
|
+
- [`edit.json`](https://github.com/drknowhow/kinescript/blob/main/examples/edit.json): a cut list with a
|
|
209
|
+
punch-in, a transition, a lower third, a callout, karaoke captions and a music bed, 10.4 s.
|
|
210
|
+
- [`3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/3d.json): a camera move past layers
|
|
211
|
+
at several depths and a card that turns over, 6 s.
|
|
212
|
+
- [`model.json`](https://github.com/drknowhow/kinescript/blob/main/examples/model.json): lit primitives and a
|
|
213
|
+
ring around a ball that builds in and flies apart, 6 s.
|
|
214
|
+
- [`title3d.json`](https://github.com/drknowhow/kinescript/blob/main/examples/title3d.json): the brand mark as an
|
|
215
|
+
extruded SVG path and the wordmark as extruded text, 5 s.
|
|
216
|
+
- [`import.json`](https://github.com/drknowhow/kinescript/blob/main/examples/import.json): a glTF rocket on a
|
|
217
|
+
ground shadow, 6 s.
|
|
218
|
+
- [`voiceover.json`](https://github.com/drknowhow/kinescript/blob/main/examples/voiceover.json): titles cued from
|
|
219
|
+
the words of a voice-over, karaoke captions of it, and a music bed that dips under it, 5.4 s.
|
|
220
|
+
- [`narrated.json`](https://github.com/drknowhow/kinescript/blob/main/examples/narrated.json): the same idea
|
|
221
|
+
with a voice written as text, a marked word and a click on it. Run `kine voice examples/narrated.json` first.
|
|
222
|
+
|
|
223
|
+
`edit.json`, `import.json`, `voiceover.json` and `narrated.json` read sample media: run
|
|
224
|
+
`python examples/make_media.py` first to generate it.
|
|
225
|
+
|
|
226
|
+
## Performance
|
|
227
|
+
|
|
228
|
+
Measured on the development machine (Intel Core Ultra 7 265, 20 threads, NVIDIA RTX 5060 Ti, Windows 11),
|
|
229
|
+
2026-10-30:
|
|
230
|
+
|
|
231
|
+
| Workload | Result |
|
|
232
|
+
|---|---|
|
|
233
|
+
| Drawing one 1080p frame of the launch video on the GPU, converted to I420 and read back as a render does | median 2.8 ms, p95 3.8 ms (all 1038 frames) |
|
|
234
|
+
| Launch video, 34.6 s at 1080p30, `-q high`, with audio | 3.3 s wall, about 320 frames/s (median of 5 runs) |
|
|
235
|
+
| `examples/edit.json`, 10.4 s with two decoded video clips | 2.25 s wall, 139 frames/s (median of 5 runs) |
|
|
236
|
+
|
|
237
|
+
[`python bench/stages.py`](https://github.com/drknowhow/kinescript/blob/main/bench/stages.py) splits the time
|
|
238
|
+
per frame into drawing, conversion and readback, and writing to ffmpeg for several workloads, and times whole
|
|
239
|
+
renders.
|
|
240
|
+
|
|
241
|
+
Rendering uses Skia on the GPU through a hidden OpenGL context, one per worker process. Frames are split into
|
|
242
|
+
chunks, encoded in parallel and joined without re-encoding, while another ffmpeg process mixes the audio.
|
|
243
|
+
Within one process, such as the MCP server, the workers stay warm for two minutes between renders.
|
|
244
|
+
|
|
245
|
+
## Limits
|
|
246
|
+
|
|
247
|
+
- Without a usable GPU, Kinescript falls back to Skia's CPU rasteriser. With the Windows `skia-python` wheel this is
|
|
248
|
+
very slow (about 0.65 s per 1080p frame for the launch video); use `--scale 0.5` for previews on such machines.
|
|
249
|
+
`KINE_BACKEND=cpu` forces this path.
|
|
250
|
+
- 3D is drawn by Skia with a depth sort, not a GL pipeline: models have no image textures, skeletal animation or
|
|
251
|
+
shadows cast on each other, and separate model layers do not hide each other per pixel (merge touching
|
|
252
|
+
objects as `parts` of one model). Draco- and meshopt-compressed model files are not read.
|
|
253
|
+
- Audio is mixing and levelling (trim, gain over time, fades, speed, loop, pan, role levels, ducking, a loudness
|
|
254
|
+
target), with no effects such as EQ, compression of single sounds or reverb.
|
|
255
|
+
- Kinescript does not speak by itself: `kine voice` needs a plugin or a command. The Kokoro plugin times words
|
|
256
|
+
for English voices only and needs Python 3.10 to 3.12.
|
|
257
|
+
- Video is decoded and resampled by ffmpeg to the scene frame rate. Jumping backwards or far ahead reopens the
|
|
258
|
+
decoder, which is slower than sequential playback.
|
|
259
|
+
- Text layout is single-script left-to-right with greedy wrapping. No shaping for complex scripts or bidi.
|
|
260
|
+
- Expressions are limited to arithmetic and the listed helpers; attribute access and other names are rejected.
|
|
261
|
+
|
|
262
|
+
## Project layout
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
kinescript/ engine: timing, props, scene, components, render (Skia), space, render3d,
|
|
266
|
+
mesh and models (3D), output (encoding and the audio mix),
|
|
267
|
+
verify (check, look, probe), schema, docs, mcp, cli
|
|
268
|
+
examples/ example scenes and the generator for sample media
|
|
269
|
+
plugins/ kinescript-kokoro, the Kokoro voice for kine voice (installed on its own)
|
|
270
|
+
marketing/ the launch video as a scene and its builder; build_site.py renders the site
|
|
271
|
+
site/ the project site: demo scenes next to the videos rendered from them
|
|
272
|
+
brand/ logo files, generated art and the brand guide
|
|
273
|
+
bench/ per-stage timing of frames and whole renders
|
|
274
|
+
content/ launch post and social copy
|
|
275
|
+
tests/ pytest suite
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
MIT, see [`LICENSE`](https://github.com/drknowhow/kinescript/blob/main/LICENSE). The bundled fonts are under the
|
|
281
|
+
SIL Open Font License 1.1; their notices are in
|
|
282
|
+
[`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.2.0"
|
|
13
|
+
__all__ = ["Scene", "SceneError", "load", "render", "still", "__version__"]
|