window.render(t), that draws time t. VidJutsu opens the page on cloud machines, calls render(t) for every frame, and joins the frames into a video in your library. Then you place that video on a timeline like any other clip.
Nothing is generated: the picture is exactly what your page draws. Any web library that can draw a moment on request works, including GSAP, HyperFrames, Three.js and Lottie.
How it works
- Send the files.
POST /graphics/fileslists every file of your scenes by hash. Small text files go inline; anything else gets an upload link. Files you sent before are never sent again. - Render.
POST /graphicswith afilm: the frame size, frame rate, finishing effects and the scenes in order. It answers with a job right away. - Wait. Poll
GET /graphics/{job_id}untilstateissucceeded.output.mediais the new video,output.watch_urlplays it in a browser. - Place it. Add
output.mediato a project with anadd_mediaedit and put it on a track withinsert_clip. Nothing is placed for you.
The scene contract
A scene is a folder with an entry page (defaultindex.html). The page must define a global function, window.render(t) by default, where t is seconds from the scene’s start. It can return a promise; the frame is taken once it settles.
render(t) must draw time t from t alone:
- Same
t, same picture. Frames are drawn in pieces on many machines and in any order, sorender(t)can’t depend on the frame drawn before it. Set every animated property fromton every call, and keep no state between frames. - No network. The page can load its own files and nothing else. Ship libraries, images and fonts in the scene folder; links to a CDN or any other site fail.
- Clocks are frozen to
t.Date,performance.now()andrequestAnimationFramecallbacks all see timet(callbacks run once a frame, afterrender(t)), andMath.random()is seeded, so it returns the same numbers on every machine. CSS animations and transitions don’t followt: drive motion fromrender(t)instead.
the scene is not repeatable and names the time, because two pieces that disagree would flicker where they meet.
The usual causes: a value that adds to itself each frame (x += 2), a CSS animation or transition, or an image that hasn’t loaded when the frame is taken (make render(t) async and wait for it). A subtler one: once an element is fully in, set the property to its plain resting value, such as clip-path: none rather than an inset of 0%. Some effects at their end value draw their edge a shade differently depending on the frame before.
Starter scene: a title card and a lower third
Two scenes, played one after the other. Copy the folder, change the words at the top of each page, and render it.film.json
title/index.html
lower-third/index.html
The film
Each scene:
Effects
Effects run on every frame after it is drawn. Pick them by name:Libraries
Put the library’s file in the scene folder and load it with a relative path. A frozenwindow.vidjutsu helper is defined before your scripts run; each adapter sets render(t) for you.
GSAP (and HyperFrames):
repeat: -1 on its own) doesn’t follow t.
Three.js:
t (t * 0.9), never by adding to them each frame (rotation.y += 0.01). Physics or particles that step forward need to be stepped from zero up to t on every call, or baked ahead of time.
Lottie:
animationData from a script file rather than path: a path loads after the page does, so the first frames can be drawn before the animation is there, and the job stops as not repeatable.
Fonts
Inter, Inter Display, DejaVu Sans and Sans Mono, Liberation (as Arial), JetBrains Mono, Satoshi and Noto Color Emoji are installed. Any other font goes in the scene folder and loads with@font-face:
render(t) can be async: await document.fonts.ready at the top works.
Footage in a scene
To draw over a take, put the video in the scene folder and let the scene turn it into numbered stills before drawing:n = floor(t * 30) + 1 at time t (the starter lower third does this when FOOTAGE_FPS is set). frames must be a subfolder with no other scene files. Up to 8 extracts a scene; start_number (default 1) and jpeg_q (2 best to 31, default 2) are optional.
Run it
bundle id and missing: a put_url for each file that isn’t stored yet and wasn’t sent inline (images, fonts, footage, large scripts). PUT each file’s bytes to its link. Then render:
film.json: vidjutsu graphics render ./starter. MCP: graphics_files, make_graphics, graphics_status and cancel_graphics.
Place it on a timeline
output.media is ready for an add_media edit (give it any id you like in the project). Graphics videos are opaque and silent, so put full-frame cards where they should cover the picture: on the main track between takes, or on a track above it for the stretch they play.
ripple, the takes after it move later so sound stays in sync. A lower third over a take can go two ways:
- Draw the take in the scene (footage in a scene), and place the result on a track above the take for the same stretch. Exact, and the panel can be any shape.
- Render just the panel: make the film the panel’s size (say 720 x 200) and length, and place it in a
layoutbox above the take. Cheaper, but the panel is a rectangle: rounded corners show the page’s background.
Edit scenes in a workspace
A workspace is a named folder of scene files with versions, so an agent can change scenes like code instead of resending them:GET /graphics/workspaces/{workspace}(graphics_list): the currentbundle, itsversion, every file, and earlier bundles.GET /graphics/workspaces/{workspace}/file?path=title/index.html(graphics_read): one file’s text.POST /graphics/workspaces/{workspace}(graphics_write): one new version made ofwrite(whole text files),patch({path, find, replace}, wherefindmust occur exactly once),files(other files by hash; missing ones get a PUT link),delete, orrestore(an earlier bundle). Sendexpected_bundlefrom your last read: if someone changed the workspace since, it answers 409 and nothing changes.
"workspace": "episode-4" in place of bundle. The job is pinned to the workspace’s bundle at that moment, so later writes don’t change a running job. To change scenes from an earlier job that didn’t use a workspace, GET /graphics/bundles/{bundle} (graphics_source) gives every file of the bundle in output.source.
Files in a workspace are stored, never run: the only thing that runs them is the renderer, inside a job.
Upright video
For Shorts, Reels and TikTok, render at1080 x 1920. Keep text out of the zones each app covers with its own buttons and captions: the top 328 pixels, the bottom 672 and 120 at each side.
Speed and cost
Graphics are billed by the box time they use, at $0.03 per vCPU-minute by the second, like a render ([pricing](/pricing)). A 1080p, 30 fps film takes about 16 vCPU-seconds per second of film for each subframe, about $0.48 a minute, plus about 120 vCPU-seconds to start; a re-render after a one-scene change costs far less. There is no price up front. While a job runs, your wallet holds a small amount at a time and gives back what the job didn’t use.usage.vcpu_seconds on the job is what you paid for.
Almost all of that time is the browser painting your page on the CPU (there is no GPU), so a lighter page is a cheaper one:
- Large CSS
filter: blur()andbackdrop-filterlayers are the slowest thing to draw. Use a pre-blurred image instead. subframesmultiplies the work: use2for fast motion,1for slow fades and text.- Big WebGL scenes draw on the CPU too: keep polygon counts and resolution in check.
- Scenes that didn’t change are free to reuse, so split long films into scenes.