# Turn YouTube videos into RAG chunks for AI

**Use case:** 

Convert YouTube videos into LLM-ready Markdown and chapter-aware transcript chunks, ready to embed in a vector database such as Pinecone, Qdrant or Supabase. Each chunk has a timestamp, word count, chapter and a deep link to the exact moment in the video, so answers can cite their source. The example processes three well-known TED talks.

## Input

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=iG9CE55wbtY",
    "https://www.youtube.com/watch?v=arj7oStGLkU",
    "https://www.youtube.com/watch?v=qp0HIF3SfI4"
  ],
  "playlistUrls": [],
  "channelUrls": [],
  "maxVideos": 50,
  "channelMode": "latest",
  "publishedAfter": "",
  "publishedBefore": "",
  "language": "",
  "preferManualCaptions": true,
  "fixUrduScript": true,
  "removeNonSpeechTags": false,
  "includeSegments": true,
  "includeMetadata": true,
  "includeSrt": false,
  "includeVtt": false,
  "includeMarkdown": true,
  "includeChunks": true,
  "chunkSizeWords": 300,
  "chunkOverlapWords": 30,
  "maxConcurrency": 10,
  "maxRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

## Output

```json
{
  "videoId": {
    "label": "Video ID",
    "format": "string"
  },
  "title": {
    "label": "Video title",
    "format": "string"
  },
  "markdown": {
    "label": "Markdown",
    "format": "string"
  },
  "chunks": {
    "label": "RAG chunks",
    "format": "array"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The YouTube Transcript API & Scraper Actor is ready to run with the inputs already set for "Turn YouTube videos into RAG chunks for AI". [Sign up or log in](https://console.apify.com/create-task-from-example/Z1uQ7Ok3R0lhwZkLY) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Turn YouTube videos into RAG chunks for AI" task

The YouTube Transcript API & Scraper Actor will start running based on the input automatically. You can also change all the input fields, like youtube video or shorts urls, youtube playlist urls, and more, to match your specific use case.

### 3. Receive the "Turn YouTube videos into RAG chunks for AI" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as video id, video title, markdown, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Turn YouTube videos into RAG chunks for AI" task via API](https://apify.com/panix/youtube-transcript-scraper.md).

## FAQ

### What is in each chunk?

Each chunk from the YouTube RAG task has the transcript text, its start time, word count, the video chapter and a deep link that opens the video at that moment, plus the video ID and title.

### Which chunk size should I use?

300 words with 30 words of overlap suits most embedding models. The YouTube RAG task accepts 50 to 2,000 words per chunk and up to 500 words of overlap.

### Can I process a whole channel or playlist?

Add channel or playlist URLs next to the video links. The YouTube RAG task removes videos found through several sources and keeps the original order.

### How much does the YouTube RAG task cost?

The YouTube RAG task charges per delivered transcript, with Markdown and chunks included: $0.003 per video on the Apify Free plan and $0.00275 on Starter, less on bigger plans, plus $0.003 per run.

## About this Actor

This example demonstrates how to use [YouTube Transcript API & Scraper](https://apify.com/panix/youtube-transcript-scraper.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/panix/youtube-transcript-scraper.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/panix/youtube-transcript-scraper.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
