Konecz

What is video as code, and why do AI agents make video this way?

Article by

Video as code means writing a video the same way you write a website: text, colors, positions and motion in HTML, CSS and JavaScript. An engine opens that page, steps through it frame by frame and writes each frame into an MP4 file. Because AI agents already write web pages well, this format lets an agent make a whole video without opening a drag-and-drop editor.

What does a video written as code look like?

It is a folder with an index.html file. At the top of the page, a small block declares the size of the video, how many frames per second it has and how many frames it lasts. The rest is an ordinary page.

In Kodecz, the video engine built by Konecz, that block looks like this:

<script type="application/json" id="kodecz">
{ "id": "MyVideo", "width": 1080, "height": 1920, "fps": 30, "frames": 450 }
</script>

That means a vertical video of 1080 by 1920 pixels, 30 frames per second, 450 frames long (15 seconds). A title that enters on frame 15 is just a CSS animation delayed by 15 frames. Recorded video, music and voice go in as <video> and <audio> inside the same folder, each with the frame where it starts.

Why not use a regular video editor?

Because a regular editor was built for eyes and hands. A person looks at the timeline, drags a cut, listens and adjusts. An AI agent has no hands and no screen. It has files, commands and text.

When the video is code, everything the agent is good at starts to count:

  1. Writing: the video is text, and text is what a model produces best.
  2. Changing one part only: a new title color is one changed line, and nothing else has to be redone.
  3. Repeating without drift: the same folder gives the same video. In Kodecz, frame N depends only on the page and on N.
  4. Checking by rule: you can measure where every piece of text sits in every frame, because the engine knows.

If the agent writes well, where does it go wrong?

The agent rarely gets the code wrong. It gets wrong what only shows up when two things meet on screen. In the analysis of 27 defects from our own videos, described in the Kodecz paper, 21 were relations between two things: text over a face, motion out of step with speech, a cut in the middle of a word. Reading the code alone, none of that is visible.

So video as code is not enough on its own. The agent needs to see what it wrote. Kodecz gives it that in three ways:

The loop becomes: write, look, check, fix, and only then render the MP4.

What kind of video comes out this way?

Anything a browser can draw: animated type, charts, diagrams, 3D scenes in WebGL, word-by-word captions, a recorded presenter with a zoom. What code does not do well is photorealistic imagery. In those cases the picture comes from somewhere else (filming or generative AI) and the code handles what goes on top: text, pacing, cuts and brand.

The Konecz portfolio, which held 108 videos on November 19, 2026, shows the three styles side by side. «Vinho verde não é verde» (Vinho Verde is not green), from the Vinhedo Digital profile, is 2D. «A senha do cofre imperial (Matemática, motion)», from Fabio Hoinaski's school lessons, is 3D. «Esse drink americano tem nome em francês», from Ratomix, is realistic. In all of them, the final assembly is a page that becomes a video.

Who needs to understand this?

Developers who want their own agent to make videos: the format is plain web, with no new language to learn. And business owners who buy AI-made video: when the video is code, every mistake has a name and a rule, and the provider can tell you what was checked before delivery.

Frequently asked questions

Do I need to code to use video as code? To write it by hand, yes, basic HTML and CSS. With an AI agent, you describe the video and the agent writes the page.

Does video as code work for videos with a person talking? Yes. The recorded footage goes into the page, and the code handles the captions, the zoom and the text around the face.

Is the output always the same? In Kodecz, frame N comes out with the same content, in order or out of order. Animated text can vary by up to 2 color levels out of 255, which you cannot see.

Where can I learn more? In the Kodecz launch post and in the summary of the paper on AI agents making video.

Kodecz is the engine Konecz uses for the videos it posts every day for its clients. If you want the finished video without writing anything, see the Konecz plans or the portfolio.

Markdown version