Examples

Library playground

Everything below runs @vid2context/core, the library behind the CLI, the MCP server and the HTTP API, in your browser. Pick a context, change an option and the output follows. The box under each operation shows the exact code it ran; Edit as code copies it into the code box, where you can change anything.

Context

Real VideoContext output from tests/fixtures/contexts/ in the repo.

Me at the zoo: 6 segments, 0:19, en, creator captions, 3 chapters

Section and cleanup

Seconds, m:ss or h:mm:ss.

Sections from transcriptOutline.

Core function

SubRip (.srt) captions: at most 2 lines of 42 characters per cue, no overlaps, for players and editors.

Bilingual: add a second transcript

A Transcript or a whole VideoContext of the same video in another language. Each of its segments goes under the primary segment it overlaps most. Not kept in shared links.

This runs in a worker
return core.render(context, 'srt');
srt: 415 characters
1
00:00:01,200 --> 00:00:03,360
All right, so here we are,
in front of the elephants

2
00:00:05,318 --> 00:00:07,974
the cool thing about these guys
is that they have really...

3
00:00:07,974 --> 00:00:12,616
really really long trunks

4
00:00:12,616 --> 00:00:14,367
and that's cool

5
00:00:14,421 --> 00:00:15,733
(baaaaaaaaaaahhh!!)

6
00:00:16,881 --> 00:00:18,881
and that's pretty much all there is to say

In scope: core (all of @vid2context/core), context (the context above, before section and cleanup) and secondary (the second transcript, or undefined). Return a value; console.log works too. Runs in a Web Worker, stopped after 5 seconds.

or Ctrl+Enter
Press Run to see the result.

What you can change

  • Context: one of the real fixtures from the repo, a VideoContext you paste (the body of GET /api/v1/context), or one fetched live from this site's API or your own server.
  • Section and cleanup: getSection cuts a time range or a chapter; cleanTranscript removes sound tags, rebuilds sentences and drops fillers. Both return new objects, so the raw transcript is never changed.
  • Operation: render with each format's own options, chunkTranscript, transcriptOutline, estimateTokens across every format, agentPrompt and the cleanup report.
  • Your code: an async function body with core, context and secondary in scope. It runs in a Web Worker with no access to this page.

The address bar keeps every choice and your code, so a copied link opens the same run. Pasted JSON stays on your machine and is never put in a link.

Token counts come from estimateTokens, a fast estimate made for budgets, not billing. Read a long video by chapter does the same with outlines and sections through the API.