Read a long video by chapter
Speech runs at about 12,000 tokens per hour of video. A model can read that, but it rarely needs all of it, and long transcripts crowd out everything else in its context. The pattern that works: look at the outline first, then fetch only the part you need.
The MCP server gives agents the same steps as tools (get_outline, then get_section), and each block below shows the tool call next to the HTTP request.
1. Look at the outline
/outline lists the chapters with their start times, timestamp links and an estimate of the tokens in each. For "Me at the zoo" these are the creator's three chapters.
/api/v1/outlineOutline with token countscurl -G https://vid2context.com/api/v1/outline \
--data-urlencode 'url=https://www.youtube.com/watch?v=jNQXAC9IVRw'const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
url: 'https://www.youtube.com/watch?v=jNQXAC9IVRw',
});
const res = await fetch(`${BASE}/api/v1/outline?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(JSON.stringify(await res.json(), null, 2));import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/outline?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(json.dumps(json.load(res), indent=2))
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}"){
"name": "get_outline",
"arguments": {
"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"
}
}{
"metadata": {
"ref": {
"input": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
"platform": "youtube",
"kind": "video",
"id": "youtube:jNQXAC9IVRw",
"nativeId": "jNQXAC9IVRw",
"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"
},
"title": "Me at the zoo",
"description": "Microplastics are accumulating in human brains at an alarming rate\nhttps://www.youtube.com/watch?v=0PT5c1z3LL8\n\n“Nanoplastics and Human Health” with Matthew J Campen, PhD, MSPH\nhttps://www.youtube.com/watch?v=RRBN_4L09Mg\n\n00:00 Intro\n00:05 The cool thing\n00:17 End",
"durationSec": 19,
"publishedAt": "2005-04-23",
"thumbnailUrl": "https://i.ytimg.com/vi/jNQXAC9IVRw/hqdefault.jpg?sqp=-oaymwEmCOADEOgC8quKqQMa8AEB-AG-AoAC8AGKAgwIABABGFUgWShlMA8=&rs=AOn4CLA9eLBatYv9WbkD4BbZ2Im-biSPTw",
"tags": [
"me at the zoo",
"jawed karim",
"first youtube video"
],
"chapters": [
{
"title": "Intro",
"startSec": 0,
"endSec": 5
},
{
"title": "The cool thing",
"startSec": 5,
"endSec": 17
},
{
"title": "End",
"startSec": 17,
"endSec": 19
}
],
"isLive": false,
"extra": {
"viewCount": 448539222,
"likeCount": 20138476,
"dateText": "Apr 23, 2005",
"channelHandle": "@jawed",
"channelHandleUrl": "https://www.youtube.com/@jawed",
"subscriberCountText": "6.74M subscribers",
"isShort": false,
"isLive": false,
"isUpcoming": false,
"isLiveContent": false,
"ageRestricted": false,
"membersOnly": false,
"playability": "OK",
"chapterSource": "description",
"links": [
"https://www.youtube.com/watch?v=0PT5c1z3LL8",
"https://www.youtube.com/watch?v=RRBN_4L09Mg"
]
},
"channel": {
"name": "jawed",
"id": "UC4QobU6STFB0P71PMvOGN5A",
"url": "https://www.youtube.com/channel/UC4QobU6STFB0P71PMvOGN5A"
}
},
"chapters": [
{
"title": "Intro",
"startSec": 0,
"endSec": 5,
"tokens": 14
},
{
"title": "The cool thing",
"startSec": 5,
"endSec": 17,
"tokens": 37
},
{
"title": "End",
"startSec": 17,6 more lines not shown. Run it to see the whole response.
2. Videos without chapters
When a video has no chapters, the outline splits it into sections of about five minutes, cut where the speech pauses, so the same next step works on any video. Up to about seven minutes of speech stays one section, as in this 7:26 video; a longer one gets one entry per five minutes or so.
/api/v1/outlineOutline of a video without chaptersNo chapters, so the outline is sections of about five minutes, cut where the speech pauses.
curl -G https://vid2context.com/api/v1/outline \
--data-urlencode 'url=https://www.youtube.com/watch?v=MBRqu0YOH14'const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
url: 'https://www.youtube.com/watch?v=MBRqu0YOH14',
});
const res = await fetch(`${BASE}/api/v1/outline?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(JSON.stringify(await res.json(), null, 2));import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"url": "https://www.youtube.com/watch?v=MBRqu0YOH14",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/outline?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(json.dumps(json.load(res), indent=2))
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}"){
"name": "get_outline",
"arguments": {
"url": "https://www.youtube.com/watch?v=MBRqu0YOH14"
}
}{
"metadata": {
"ref": {
"input": "https://www.youtube.com/watch?v=MBRqu0YOH14",
"platform": "youtube",
"kind": "video",
"id": "youtube:MBRqu0YOH14",
"nativeId": "MBRqu0YOH14",
"url": "https://www.youtube.com/watch?v=MBRqu0YOH14"
},
"title": "Optimistic Nihilism",
"description": "The philosophy of Kurzgesagt.\n\n\nOUR CHANNELS\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nGerman Channel: https://kgs.link/youtubeDE \nSpanish Channel: https://kgs.link/youtubeES \n\n\nHOW CAN YOU SUPPORT US?\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nThis is how we make our living and it would be a pleasure if you support us!\n\nGet Merch designed with ❤ from https://kgs.link/shop \nJoin the Patreon Bird Army 🐧 https://kgs.link/patreon \n\n\nDISCUSSIONS & SOCIAL MEDIA\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nReddit: https://kgs.link/reddit\nInstagram: https://kgs.link/instagram\nTwitter: https://kgs.link/twitter\nFacebook: https://kgs.link/facebook\nDiscord: https://kgs.link/discord\nNewsletter: https://kgs.link/newsletter\n\n\nOUR VOICE\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nThe Kurzgesagt voice is from \nSteve Taylor: https://kgs.link/youtube-voice\n\n\nOUR MUSIC ♬♪\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n700+ minutes of Kurzgesagt Soundtracks by Epic Mountain:\n\nSpotify: https://kgs.link/music-spotify\nSoundcloud: https://kgs.link/music-soundcloud\nBandcamp: https://kgs.link/music-bandcamp\nYoutube: https://kgs.link/music-youtube\nFacebook: https://kgs.link/music-facebook\n\nThe Soundtrack of this video:\nSoundcloud: http://bit.ly/2vZRSnI\nBandcamp: http://bit.ly/2tYuKUY\nFacebook: http://bit.ly/2qW6bY4\n\n\nHelp us caption & translate this video!\n\nhttp://www.youtube.com/timedtext_cs_panel?c=UCsXVk37bltHxD1rDPwtNM8Q&tab=2\n\nOptimistic Nihilism",
"durationSec": 446,
"publishedAt": "2017-07-26",
"thumbnailUrl": "https://i.ytimg.com/vi/MBRqu0YOH14/maxresdefault.jpg",
"language": "en",
"tags": [
"optimism",
"existence",
"existential",
"meaning of life",
"purpose",
"existentialism",
"atheism",
"philosophy",
"nihilism"
],
"chapters": [],
"isLive": false,
"extra": {
"viewCount": 18903134,
"likeCount": 982145,
"dateText": "Jul 26, 2017",
"channelHandle": "@kurzgesagt",
"channelHandleUrl": "https://www.youtube.com/@kurzgesagt",
"subscriberCountText": "25.8M subscribers",
"isShort": false,
"isLive": false,
"isUpcoming": false,
"isLiveContent": false,
"ageRestricted": false,
"membersOnly": false,
"playability": "OK",
"links": [
"https://kgs.link/youtubeDE",
"https://kgs.link/youtubeES",
"https://kgs.link/shop",
"https://kgs.link/patreon",
"https://kgs.link/reddit",
"https://kgs.link/instagram",
"https://kgs.link/twitter",
"https://kgs.link/facebook",
"https://kgs.link/discord",
"https://kgs.link/newsletter",
"https://kgs.link/youtube-voice",
"https://kgs.link/music-spotify",
"https://kgs.link/music-soundcloud",
"https://kgs.link/music-bandcamp",
"https://kgs.link/music-youtube",
"https://kgs.link/music-facebook",
"http://bit.ly/2vZRSnI",
"http://bit.ly/2tYuKUY",
"http://bit.ly/2qW6bY4",
"http://www.youtube.com/timedtext_cs_panel?c=UCsXVk37bltHxD1rDPwtNM8Q&tab=2"
]
},
"channel": {
"name": "Kurzgesagt – In a Nutshell",
"id": "UCsXVk37bltHxD1rDPwtNM8Q",
"url": "https://www.youtube.com/channel/UCsXVk37bltHxD1rDPwtNM8Q"
}
},
"chapters": [
{
"title": "0:00 to 7:26",
"startSec": 0,
"endSec": 446,
"tokens": 1332
}
],2 more lines not shown. Run it to see the whole response.
3. Fetch one chapter
/section returns one chapter of the transcript, by its outline index (0, 1, ...) or by its title. A title matches exactly first, then as a prefix, then as a substring, so cool would find "The cool thing" too.
/api/v1/sectionOne chaptercurl -G https://vid2context.com/api/v1/section \
--data-urlencode 'url=https://www.youtube.com/watch?v=jNQXAC9IVRw' \
--data-urlencode 'chapter=The cool thing' \
--data-urlencode format=text \
--data-urlencode timestamps=1const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
url: 'https://www.youtube.com/watch?v=jNQXAC9IVRw',
chapter: 'The cool thing',
format: 'text',
timestamps: '1',
});
const res = await fetch(`${BASE}/api/v1/section?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(await res.text());import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
"chapter": "The cool thing",
"format": "text",
"timestamps": "1",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/section?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(res.read().decode())
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}"){
"name": "get_section",
"arguments": {
"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
"chapter": "The cool thing",
"format": "text",
"timestamps": true
}
}[0:05] the cool thing about these guys is that they have really...
[0:07] really really long trunks
[0:12] and that's cool
[0:14] (baaaaaaaaaaahhh!!)
[0:16] and that's pretty much all there is to say
4. Or a time range
from and to take seconds (300), m:ss (5:00) or h:mm:ss. to is exclusive. This is the sixth minute of an 18-minute G-Wagon buyer's guide.
/api/v1/sectionA time rangefrom and to take seconds, m:ss or h:mm:ss. to is exclusive.
curl -G https://vid2context.com/api/v1/section \
--data-urlencode 'url=https://www.youtube.com/watch?v=cCPsdFdlshc' \
--data-urlencode from=5:00 \
--data-urlencode to=6:00 \
--data-urlencode format=text \
--data-urlencode timestamps=1const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
url: 'https://www.youtube.com/watch?v=cCPsdFdlshc',
from: '5:00',
to: '6:00',
format: 'text',
timestamps: '1',
});
const res = await fetch(`${BASE}/api/v1/section?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(await res.text());import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"url": "https://www.youtube.com/watch?v=cCPsdFdlshc",
"from": "5:00",
"to": "6:00",
"format": "text",
"timestamps": "1",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/section?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(res.read().decode())
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}"){
"name": "get_section",
"arguments": {
"url": "https://www.youtube.com/watch?v=cCPsdFdlshc",
"from": "5:00",
"to": "6:00",
"format": "text",
"timestamps": true
}
}[4:58] They're robust, reliable.
[5:00] They work really well.
[5:01] They just drink a little oil.
[5:02] They drink a little oil.
[5:03] As they age, one thing you will note on these trucks is they will drink some oil.
[5:06] Well, this one's got 131,000 miles on it, and it drinks a quart and a half between oil changes.
[5:11] You know what, though?
[5:12] Not that bad.
[5:13] My 2018 Audi Q7 drank about a quart between oil changes, which is normal.
[5:18] Blake, you have an Audi.
[5:19] You know this drill.
[5:20] Blake, who's filming this.
[5:22] And it happens.
[5:23] Yeah.
[5:24] You know, I'm not making excuses for anyone.
[5:25] You just got to just say, hey, I want a G55.
[5:28] I'll preface, that's on a 5,000-mile service interval, too.
[5:31] Yeah.
[5:31] So, they're pretty easy to maintain.
[5:32] So, still uses the 113 motor, super reliable.
[5:36] So, this generation was available with the M113 up until through 2012.
[5:41] Yes.
[5:42] So, you have two options, G500 or the G55 AMG.
[5:45] Let's take a look inside.
[5:46] Yep.
[5:47] So, come around here, Blake.
[5:48] Hop in.
[5:48] I want to touch on a couple things here.
[5:50] So, the big thing on these trucks, and this is an MBUSA truck, is the first thing you're
[5:55] going to notice is the door panel.
[5:57] It is physically wider.
[5:58] We've now got our door switches and our seat switches on the door.
5. Fit a token budget
When a model should see the whole video but has a fixed budget, ask for a context pack. maxTokens sets the size: the pack keeps the metadata, the chapters and the citation rule, shortens the description, and cuts the transcript where the budget runs out. Each cut is marked with what was left out, so the model knows which section to fetch next.
/api/v1/packA context pack for one videoOne Markdown file sized for a token budget, with citation instructions for the model.
curl -G https://vid2context.com/api/v1/pack \
--data-urlencode 'url=https://www.youtube.com/watch?v=cCPsdFdlshc' \
--data-urlencode maxTokens=1500const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
url: 'https://www.youtube.com/watch?v=cCPsdFdlshc',
maxTokens: '1500',
});
const res = await fetch(`${BASE}/api/v1/pack?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(await res.text());import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"url": "https://www.youtube.com/watch?v=cCPsdFdlshc",
"maxTokens": "1500",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/pack?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(res.read().decode())
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}")npx -y vid2context pack 'https://www.youtube.com/watch?v=cCPsdFdlshc' --max-tokens 1500# Video context pack
This document holds the transcripts and metadata of one video (18:04 in total), prepared by vid2context for an AI model to read. Each transcript paragraph starts with the time it begins in the video, in brackets; linked times open the video at that moment.
Citation rule: when you use something from a video, cite it as [Title @ m:ss](link), using the time and link of the paragraph you drew on (or [Title @ m:ss] when the video has no link).
Some content was left out to fit a budget of 1500 tokens. Each cut is marked where it happened.
## Best & Worst G-Wagon Years: Reliability, Interiors & Engines Ranked!
- Channel: [Alliance Motorworks](https://www.youtube.com/channel/UCdEjP_BjQ5audhxLKKzZl2A)
- Published: 2025-03-09
- Duration: 18:04
- Source: https://www.youtube.com/watch?v=cCPsdFdlshc
- Language: en
- Transcript: speech-to-text by stt/cloudflare/@cf/openai/whisper-large-v3-turbo
### Description
> Watch this side-by-side comparison of G-Wagons from 2000 - 2018 to rank the best and worst for interiors, engines, and reliability. This is part 1 of a multi-video series for buying and building your
_Description shortened to 199 of 799 characters._
### Chapters
- [0:00](https://www.youtube.com/watch?v=cCPsdFdlshc&t=0s) G wagon buying guide
- [1:05](https://www.youtube.com/watch?v=cCPsdFdlshc&t=65s) G500 m113 engine overview
- [2:04](https://www.youtube.com/watch?v=cCPsdFdlshc&t=124s) G500 interior and features
- [4:12](https://www.youtube.com/watch?v=cCPsdFdlshc&t=252s) G55 AMG specs and history
- [5:50](https://www.youtube.com/watch?v=cCPsdFdlshc&t=350s) G55 interior and technology
- [8:25](https://www.youtube.com/watch?v=cCPsdFdlshc&t=505s) Best G-Wagon for your budget
- [9:39](https://www.youtube.com/watch?v=cCPsdFdlshc&t=579s) G550 technological leap
- [12:27](https://www.youtube.com/watch?v=cCPsdFdlshc&t=747s) 2016-2018 G-Wagon updates
- [14:01](https://www.youtube.com/watch?v=cCPsdFdlshc&t=841s) Final recommendations
### Transcript
#### G wagon buying guide (0:00)
[0:00](https://www.youtube.com/watch?v=cCPsdFdlshc&t=0s) So you're going to buy a G-Wagon. Which year is best for you? Well, in this video, we're going to do a year-by-year breakdown of the legendary W463 platform, so you can check out the model year ranges, the engine options, and the interior, because if you buy the wrong one, I don't want you getting buyer's remorse or ending up with a bad specimen. My name's Adam. Welcome to the G-Wheel and YouTube channel. I do everything here for the love of G. I'm joined by Joe from Alliance Auto Care. He is the G-Wagon specialist and helped me produce not only these videos, but also the ultimate build and buyer's guide for the G-Wagon. So if you're in the market, click the link in the description right now. Joe, thanks for being here, man.
[0:39] All right. Let's get into it. Let's rock and roll. Let's introduce each one of these three trucks. We're going to hit the year range, the engine options, and give you an interior tour. Let's rock and roll. Cool. We have three trucks here. Starting with our first one, we have a 2000 G500. The second one is a 2012 G55 AMG. The third one is a 2015 G550. We're going to walk through and look at some of the engine options real quick. On the first one, the 2000 G500. Now, there's a couple of models prior to this one, but this is kind of the one everyone gravitates to.
#### G500 m113 engine overview (1:05)
[1:09] This one has what we know the legendary M113 V8. This was Mercedes' big hurrah into the V8s, and this is arguably one of their most reliable V8s out there. Some call it the Land Cruiser Killer. Yeah, it is known as the Land Cruiser Killer. I really like this motor. It's all aluminum. It's super light, and it is as reliable as it gets. Now, some of the key things. It's a single overhead cam motor. It's timing chains. It's two spark plugs per cylinder, and it makes 300 horsepower and 300 foot-pounds of torque. Nice round numbers.
[1:41](https://www.youtube.com/watch?v=cCPsdFdlshc&t=101s) Yeah. It looks simple. It's neat. It's clean. Most importantly, it's easy to work on. Parts are cheap, and parts are available almost everywhere. This is what we call a global motor. Yeah. Sweet. Sweet. It means if you're in Dubai, if you're in India, if you're in Japan, wherever, you can always get parts for it. Or if you're in Arkansas. Let's hop into the inside. Yeah.
> The rest, 2:04 to 18:02, is omitted for length. Fetch it with the get_section tool or the full transcript.
The pack starts with a citation rule written for the model: cite moments as [Title @ m:ss](link), with links that open the video at that second.
Next
- Many videos at once: playlists, one pack for several videos, and a zip with every format.
- Structure examples: metadata, comments, caption languages, SponsorBlock segments and generated chapters.