Make videos in Python with fframes in Vis. The agent writes a video script, looks at its frames, checks it and renders it. The Rust engine of fframes renders the frames in parallel and encodes them; Python only fills in values.
With Python, use Vis 0.8.0 or newer and Python 3.12 or newer. For Babashka, use a Vis version that supports Babashka extensions and jailed shell calls.
vis-agent extension install 'blockether/vis-reel' --global --trustFor the Python runtime, Vis installs the prebuilt fframes wheel of your platform with the extension. It holds its own FFmpeg and codec libraries:
| Platform | Requirement |
|---|---|
| macOS, Apple silicon | macOS 15 or later |
| Windows x64 | Windows 10 or later |
| Linux x86_64 | glibc 2.35 or later (Ubuntu 22.04, Debian 12, Fedora 36) |
| Linux arm64 | glibc 2.35 or later |
Use vis-agent set runtime python or vis-agent set runtime babashka to set the default.
Vis installs and loads only the implementation for the agent runtime.
The video script stays in Python in both runtimes.
Babashka does not use Vis Python. It uses :python, FFRAMES_PYTHON, or the nearest
.venv with fframes, in that order. If none is set or found, it uses uv on PATH
to install the pinned wheel. Use (reel/guide) for Babashka examples.
await reel.new("videos/intro.py", title="Hello", duration=8) # a starter script
await reel.timeline("videos/intro.py") # size, fps, scenes, audio
await reel.frames("videos/intro.py", "0s,25%,50%,end") # PNGs, attached
await reel.strip("videos/intro.py") # 12 frames on one sheet
await reel.inspect("videos/intro.py") # missing media, clipped text
await reel.render("videos/intro.py", "out/intro.mp4", draft=True)
await reel.gif("videos/intro.py", "out/intro.gif", width=960) # silent loop, 15 fps
await reel.flicker("out/intro.gif") # flashes and possible dropoutsGIF export and flicker checks need FFmpeg 5.1 or newer on PATH. A GIF uses one palette and full opaque frames, and its width defaults to the width of the video.
reel.flicker accepts a GIF, MP4 or Python script. It flags brief changes that reverse
in the next frame and large regions that briefly flatten to one color. It checks decoded
frames, not viewer playback; intentional flashes can also be flagged.
Use doc("reel.guide") in Vis to read the full guide to writing a video script.
A video script is a Python file that ends with fframes.cli(video). In the Python runtime, each tool runs it
in a new process with the first interpreter of: the python= argument, $FFRAMES_PYTHON, the nearest
.venv above the script that has fframes installed, then the interpreter of this extension.
py3 calls the tools as await reel.render("videos/intro.py", "out/intro.mp4"). The SDK calls are synchronous and work inside a Vis extension callback:
from blockether import vis
class Promo:
"""Render the promo videos of one release."""
def render(self, script: str, out: str) -> tuple[str, float]:
"""Render a draft and return the file and its frames per second."""
video = vis.tools.reel.render(script, out, draft=True)
return video.rendered.output, video.rendered.frames_per_second
ext = vis.Extension("promo", description="Promo videos of a release.")
ext.expose(Promo(), name="promo")vis.tools.reel raises vis.errors.NoCall in code that Vis does not call, and vis.errors.NotBound outside Vis.
uv sync
uv run --with pytest --with jsonschema pytest tests -q
(cd babashka && bb test)
uv run --with ruff ruff format . && uv run --with ruff ruff check .Set VIS_CONTRACT_SCHEMA_DIR to the Vis schema directory to check the contract.
Install Babashka and FFmpeg to run the runtime comparison in pytest.
See RELEASING.md to publish a release or check a GIF before posting.