The edit as data: why describe a video in JSON for an AI agent
Article by Pedro Henrique Lahr
Describing the edit in JSON means swapping a hand-written page for a list of items: this title comes in on the word «today», this caption follows the speech, this zoom lasts until the end of the sentence. kodecz assemble reads that list and builds the video page on its own. For an AI agent, filling in fields is far safer than getting hundreds of lines of HTML and CSS right.
What is wrong with writing the page by hand?
In Kodecz, every video is a web page. You can write that page directly, and an agent knows how. The trouble is timing. A title that should come in «when the presenter says today» becomes, in code, a frame number. If the speech changes a little, the number is wrong and the title arrives at the wrong time. The agent does not notice, because the code is still valid.
In the JSON edit, the title does not store a number. It stores the word. Change the speech, and assemble recalculates everything.
What does an item of the edit look like?
An example in Kodecz's own format:
{ "bloco": "titulo-entrada", "de": { "palavra": "hoje" }, "ate": { "fimDaFrase": { "palavra": "hoje" } },
"titulo": "Short title", "subtitulo": "One sentence" }
In plain words: use the title block; come in when «hoje» (today) is spoken; leave at the end of the sentence that holds it. The rest is the text. There is no pixel, frame or CSS in the request. (Field names are still in Portuguese for now.)
Which triggers are there?
| Trigger | When it happens |
|---|---|
2.5 |
at second 2.5 |
{ "palavra": "balde" } |
at the start of the first spoken «balde» |
{ "palavra": "balde", "ocorrencia": 2, "borda": "fim", "deslocamento": -0.1 } |
at the end of the second «balde», 0.1 s earlier |
{ "fimDaFrase": ... } |
at the end of the sentence that holds that moment, plus 0.15 s |
Words match without accents, punctuation or case: «agua» finds «Água,». A sentence ends on the word with a full stop, exclamation mark, question mark or ellipsis; a comma does not close it. The 0.15 s after the sentence is the pause where a zoom goes back or a strip leaves. Every trigger becomes seconds, then the nearest frame.
What happens when the agent gets it wrong?
The error says where it is and suggests the fix. If the agent writes a word that was never spoken, the message reads:
itens[2].itens[0]: word «tste» is not in the speech; closest: teste, isto
The path itens[2].itens[0] is the item's address in the edit: the first child of the third item. The closest words show what was most likely meant. An agent reads that line and fixes it without guessing. Ask for the third occurrence of a word spoken twice, and the error says how many there are.
How does a finding get back to the right item?
Through data-item. When assembling, Kodecz marks the root of every item on the page with its path: data-item="itens[0].itens[1]". Later, when the automatic checks find text over a face or a caption on two lines, the finding carries that same path and a one-line fix, such as «shorten «titulo» (up to six words)». The agent does not search the generated HTML: it goes straight back to the JSON field.
And the generated HTML is not meant to be edited. The format's rule is plain: edit the JSON, not the page.
Does assembling twice give the same result?
Yes. The page comes out as static HTML and CSS with declared animations only: no clock, no randomness, nothing timed by the real world. Assembling the same edit twice yields the same page, byte for byte. For an agent that matters a lot: if the result changed, the edit changed, not chance.
What else does assemble do?
- Reads the edit, the words file and the brand (colors and fonts).
- Resolves every trigger to a frame.
- Builds each item with its block (title, caption, zoom, title card, chart) and turns scene transitions into transition blocks.
- Places the voice, the event sounds, the sound of each stage and the music with its volume points.
- Writes the folder and runs each block's checks, passing the findings on.
The folder is written even when the check fails, so you can look at what came out.
Does this show up in Konecz videos?
At Konecz, a video no longer even has a project folder: each video's recipe lives in the database of Konectaz, the Konecz system, and combines this same JSON edit with the script and the voice. That is how videos can be produced every day for different profiles, such as Vigia Pix («39 bilhões aprovados numa segunda-feira», 39 billion approved on a Monday) and Caotleta («Empatar já dá o título», a draw is enough for the title), without rewriting a page.
Frequently asked questions
Do I have to use the JSON edit to use Kodecz? No. A hand-written page still works. The JSON edit is the safer path when the writer is an agent.
Where does each word's timing come from? From a words file with start and end in seconds, which Kodecz itself prepares from the voice and the script.
Can I see what assemble resolved without opening the page?
Yes. edicao.resolvida.json holds every start and end already in frames, so timing can be checked by reading text.
See how Kodecz checks what an agent makes in AI agents making video, or talk to Konecz to get the videos ready on your profile.