# YouTube Video Frame Extractor (TTech API)

Get JPEG frames from any YouTube video: at exact timestamps, one every N seconds, N evenly spaced, or one per chapter, at 360p to 1080p. Put a video's frames on one labelled contact sheet, ideal for an AI vision model. Only the seconds around each frame are downloaded.

Page: https://ttechapi.com/youtube-frame-extractor
Apify Actor: https://apify.com/ttechx/youtube-video-frame-extractor (id `ttechx/youtube-video-frame-extractor`)
RapidAPI: https://rapidapi.com/TTech-qcYDalkrf/api/youtube-video-frame-extractor (host `youtube-video-frame-extractor.p.rapidapi.com`)

## What it is for

- AI vision and agents: Send a contact sheet to a vision model instead of a video.
- Thumbnails and previews: Grab the exact moment you want, at up to 1080p.
- Computer vision datasets: Sample frames evenly across many videos.
- Articles and course notes: One image per chapter for summaries and docs.

## Key facts

- Four ways to choose frames: Exact timestamps, every N seconds, N evenly spaced, or one per chapter.
- Millisecond precision: The first frame at or after the time you give, decoded exactly.
- Fast on long videos: Downloads only the few seconds that hold each frame.
- Contact sheets: All of a video's frames on one labelled grid image.
- Chapter titles: Chapter mode adds each chapter's title, start and end.
- Failed frames are free: A frame past the end or from a private video is reported, not charged.

## Apify Actor

Run it with an Apify API token. Synchronous run that returns the dataset items:

```bash
curl -X POST "https://api.apify.com/v2/acts/ttechx~youtube-video-frame-extractor/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"videos": ["https://www.youtube.com/watch?v=Ap8jTCMK3c4"], "mode": "evenly", "frameCount": 16, "resolution": "720", "contactSheet": true}'
```

Input (JSON):

- `videos` (array of strings, required): Video URLs or 11-character ids, up to 500.
- `mode` (timestamps | interval | evenly | chapters): How to choose frames. Default timestamps.
- `timestamps` (array of strings): Timestamps mode: HH:MM:SS or HH:MM:SS.mmm, up to 1,000 per run.
- `intervalSeconds` (number, 0.1+): Interval mode: seconds between frames.
- `frameCount` (integer, 1-1,000): Evenly mode: frames per video.
- `position` (start | middle): Chapters mode: where in each chapter.
- `startTime, endTime` (HH:MM:SS[.mmm]): Optional range for interval, evenly and chapters modes.
- `resolution` (360 | 480 | 720 | 1080): Frame height. Default 720.
- `contactSheet, sheetColumns, sheetTileWidth` (boolean, 1-10, 120-640): One labelled grid per video, and its layout.

Example input:

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=Ap8jTCMK3c4"
  ],
  "mode": "evenly",
  "frameCount": 16,
  "resolution": "720",
  "contactSheet": true
}
```

Output: One row per video and frame:

- `imageUrl, imageKey`: Link to the JPEG and its key in the run's storage
- `timestamp`: The time of the frame
- `resolution`: The size you got, by the shorter side
- `status, error`: OK, or fail with the reason
- `chapterTitle, chapterStart, chapterEnd`: Chapters mode only
- `videoId, videoUrl`: The video

```json
{
  "videoId": "Ap8jTCMK3c4",
  "videoUrl": "https://www.youtube.com/watch?v=Ap8jTCMK3c4",
  "timestamp": "00:01:10.500",
  "resolution": "720p",
  "status": "OK",
  "imageUrl": "https://api.apify.com/v2/key-value-stores/.../records/Ap8jTCMK3c4_00-01-10.500_720p.jpg",
  "imageKey": "Ap8jTCMK3c4_00-01-10.500_720p.jpg",
  "error": null
}
```

Contact sheets are saved as <videoId>_sheet.jpg in the run's key-value store.

## RapidAPI REST API

Base URL `https://youtube-video-frame-extractor.p.rapidapi.com`. Send headers `x-rapidapi-key: YOUR_RAPIDAPI_KEY` and `x-rapidapi-host: youtube-video-frame-extractor.p.rapidapi.com`.

Endpoints:

- `GET /video/frame` (required: id, timeStamp): One frame at a timestamp
- `POST /video/frame` (required: id + timeStamps or mode): Several frames of one video
- `POST /video/sheet` (required: id + timeStamps or mode): A contact sheet: up to 100 frames on one labelled JPEG

Parameters:

- `id` (string): YouTube video id (11 characters)
- `timeStamp / timeStamps` (HH:MM:SS[.mmm]): One time (GET), or up to 128 (100 on a sheet)
- `mode` (timestamps | interval | evenly | chapters): How to choose frames (POST)
- `intervalSeconds, frameCount, position` (number, integer, start | middle): Settings of the interval, evenly and chapters modes
- `startTime, endTime` (HH:MM:SS[.mmm]): Optional range
- `offset, limit` (integer): Paging for the interval, evenly and chapters modes
- `resolution` (360 | 480 | 720 | 1080): Default 720 (360 on a sheet)
- `columns, tileWidth, labels` (sheet): Grid layout of a contact sheet

Example:

```bash
curl --request GET \
  --url 'https://youtube-video-frame-extractor.p.rapidapi.com/video/frame?id=Ap8jTCMK3c4&timeStamp=00:00:56.300&resolution=1080' \
  --header 'x-rapidapi-host: youtube-video-frame-extractor.p.rapidapi.com' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'
```

Output: POST /video/frame with two timestamps:

- `status`: OK (all frames), partial (some) or fail (none)
- `summary`: requested, succeeded and failed counts
- `results[].link`: The JPEG link, keyed by resolution
- `results[].timeStamp, status, msg`: Each frame's time, status and error message

```json
{
  "status": "OK",
  "msg": "",
  "id": "Ap8jTCMK3c4",
  "resolution": "720p",
  "summary": {
    "requested": 2,
    "succeeded": 2,
    "failed": 0
  },
  "results": [
    {
      "timeStamp": "00:00:50",
      "link": {
        "720p": "https://...jpg"
      },
      "status": "OK",
      "msg": ""
    },
    {
      "timeStamp": "00:01:10.500",
      "link": {
        "720p": "https://...jpg"
      },
      "status": "OK",
      "msg": ""
    }
  ]
}
```

GET /video/frame answers {"link": {"1080p": "https://...jpg"}, "status": "OK", "msg": ""}.

## Use as an MCP server

- Apify MCP: `https://mcp.apify.com/?tools=ttechx/youtube-video-frame-extractor` (OAuth sign-in, or header `Authorization: Bearer YOUR_APIFY_TOKEN`).
- RapidAPI MCP: `https://mcp.rapidapi.com` with headers `x-api-host: youtube-video-frame-extractor.p.rapidapi.com` and `x-api-key: YOUR_RAPIDAPI_KEY`.

## Limits

- Live streams that are still live are not supported. Private, deleted, region-locked and age-restricted videos fail with an error.
- At most 1,000 frames per video in the interval, evenly and chapters modes.
- Videos without chapters fail in chapters mode, free.

## Notes for the assistant

- Never put a real key in code you show; read it from an environment variable.
- Failed items are not charged; check each item's status or error field.
- Only public YouTube data. Not affiliated with YouTube or Google.
- Support: support@ttechapi.com, Telegram @ttech_support_official.
