DEV Community

Nidheeshdas Thavorath
Nidheeshdas Thavorath

Posted on

Stochastic Assets, Deterministic Structure: Why Video Must Be Code

Frontier video models are astonishing. They are also stochastic.

Same prompt, different day, different seed policy, different upstream weights — you get a cousin of the clip you loved, not a byte-identical twin. That is fine when you are exploring. It is hostile when you are shipping a product launch on Thursday and legal wants the logo lockup where it was on Tuesday.

SceneRok's bet is simple enough to say in one line: let models invent assets; let a compiler own structure.

This essay is about why that split is not marketing language. It is an engineering boundary.

Two different jobs got smashed into one UI

Most "AI video" products optimize for a single box: describe what you want, receive a surprise. Surprise is a feature when the job is moodboards.

Shipping video has a different job description:

  • Beat timing that matches a VO script
  • Brand elements that never drift
  • A CTA that appears at 0:12.0, not "somewhere near the end"
  • A template you can re-run when the price changes
  • A history you can diff instead of final_v7_reallyfinal.mp4

Those requirements are closer to compiling a program than to chatting with a model. If you force one mega-prompt to invent both the pixels and the edit grammar, you are asking probability to do bookkeeping. Probability is bad at bookkeeping.

What "deterministic structure" actually means

Deterministic does not mean "the generative clip never changes." It means:

Given the same resolved inputs and the same timeline source, the composition is reproducible.

Inputs include: placed media files, already-generated assets you chose to pin, fonts, timing expressions, shader choices, audio mix parameters. The compiler's job is to honor them without creative improvisation.

Stochastic steps still happen — but they happen in a named, bounded place: a function call at compile time. imagine(...), tts(...), music(...). The return value becomes an asset reference. After that, the timeline treats it like any other clip.

That is the same mental model as: fetch a dependency, then build. You do not want npm install to randomly rewrite your package.json graph every night. You especially do not want your video editor to.

Why the source of truth must be code

Chat transcripts are terrible source control.

They are linear, ambiguous, full of "make it punchier," and nearly impossible to merge across teammates. Proprietary project files are better for humans with mice — until an agent needs to change twenty parameterized end cards and open a PR.

Code gives you:

  1. Diffs — see that only the VO string and the CTA URL changed.
  2. Review — brand can reject a prompt change without scrubbing a timeline.
  3. Reuse — templates with slots, not duplicated projects.
  4. Automation — agents already speak TypeScript and DSLs; they do not speak CapCut.

In SceneRok, short declarative work lives in VidScript. Heavier branching and data-driven timing lean on @scenerok/sdk. Both emit the same intermediate timeline for preview and render. The public docs are enough to understand the shape; you do not need our private compiler guts to use the idea.

Compile-time generation vs render-time surprise

A useful pattern in programmable video: resolve generative work at compile, then render.

Why compile-time?

  • You can log what was called, with what parameters, against a wallet.
  • You can fail before you spend a long encode discovering the model timed out.
  • You can reuse a resolved asset across preview and final without re-rolling.
  • You can pin: "this clip is good — stop resampling it."

Render-time generation (invent frames while encoding) blurs cost, attribution, and reproducibility. Sometimes you want live generative effects. For launch reels and brand templates, you usually want the opposite: known assets in, deterministic mux out.

Agents need constraints more than vibes

When we say "agents author video," we do not mean "paste a novel into a prompt box." We mean: an agent edits a script under rules — duration caps, safe zones, allowed models, required end card — then asks the compiler to accept or reject.

That workflow only exists if structure is explicit. A stochastic all-in-one clip cannot tell you which rule failed. A compiler can: timing overlap, missing input, brand lockup not placed, generative call not allowed in this template.

Failure messages are product surface. Treat them like type errors, not like "the muse said no."

What we refuse to pretend

We will not claim generative video is "solved" by better prompting alone. Models will keep improving. Structure will still matter.

We will not publish fake reproducibility percentages. The qualitative claim is enough: composition is deterministic; assets are pinned or re-rolled on purpose.

We will not dump IR schemas here. You can ship the idea with a readable .vid file and a public SDK.

A concrete mental model (public surface)

Think in layers:

  1. Intent — brief, brand pack, offer parameters.
  2. Authoring — VidScript or SDK, possibly agent-written.
  3. Compile — generative functions resolve; timeline IR solidifies.
  4. Preview / final — same source, different cost curves (next essay).

If you change a model prompt, you expect new pixels in that slot — not a reshuffled edit. If you change a time range, you expect the edit to move — not a new personality from the model. That separation is the whole point.

Pinning, seeds, and intentional re-rolls

Teams new to programmable video often ask for "full determinism including the model." That is the wrong ask. Model providers change. Safety filters change. Even with a seed parameter, cross-provider identicality is a fantasy.

What you can operationalize:

  • Pin by content address or asset id once a human (or eval) accepts a take.
  • Re-roll on purpose with a new compile when exploring.
  • Never silently re-roll during preview scrub or final retry.
  • Record the function arguments you care about for audit — prompt text, model id, duration request — alongside the chosen asset.

Seeds are a hint, not a contract. Pins are a contract. Teach your agents the difference or they will "helpfully" regenerate your hero shot every PR.

Diffs as a creative review surface

Once structure is code, review rituals change.

Instead of scrubbing a 40-track timeline looking for what moved, you read a diff:

  • VO string changed → expect audio slot to change; picture timing should not.
  • model: id changed → expect that generative slot to change; brand lockup layer untouched.
  • End-card URL parameter changed → expect a localized variant, not a new edit grammar.

This is how agencies hand off to clients without exporting a museum of MP4s. This is how founders accept an agent's PR at 1 a.m. without opening an NLE. The compiler is what makes the diff trustworthy: if the timeline source did not change, composition should not invent new structure.

Template libraries beat prompt libraries

Prompt libraries age like milk. Model ids churn. Phrasing that worked in March fails in September.

Template libraries age like software. You version a .vid or .ts module with parameterized slots: offer, price, voice, footage inputs. Generative calls sit in named holes. When a provider improves, you change one function call site — not forty chat bookmarks.

SceneRok's public showcase pattern (brief + metadata + source per folder) is intentional pedagogy: the unit of reuse is a program, not a prompt scrapbook.

Closing

Stochastic assets are how we get beautiful raw material in 2026. Deterministic structure is how we ship.

If your stack cannot say which parts are allowed to surprise you, every re-render is a negotiation with entropy. Put surprise inside functions. Put the edit in code. Diff it. Fork it. Reproduce it.

That is programmable video. Try the editor and agent path at scenerok.com — and keep your lottery tickets in the asset slots, not in the timeline grammar.

Top comments (0)