# Video Frame Extractor: Frames and Scene Changes (`maliksaid/video-frame-extractor`) Actor

Extract still frames from video files: evenly spaced, every N seconds, at exact times, at scene changes or every keyframe. JPEG, PNG or WebP with timestamps, a contact sheet and video metadata. Ready for AI vision and thumbnails.

- **URL**: https://apify.com/maliksaid/video-frame-extractor.md
- **Developed by:** [Malik Said](https://apify.com/maliksaid) (community)
- **Categories:** Developer tools, AI, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 frame extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

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 examples already wired to this Actor's own input schema, see the [API](#api) section below.

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`).

# README

## Video Frame Extractor: Frames, Thumbnails, Scene Changes

Video Frame Extractor pulls still frames out of video files. You can take evenly spaced frames, one frame every N seconds, frames at exact times, frames at scene changes, or every keyframe. Each frame is saved as a JPEG, PNG or WebP file with its timestamp, and each row also carries the video's length, size, codec and frame rate. An optional contact sheet shows all frames of a video in one image.

Use it for video thumbnails, AI vision input, content review, product videos, training data and video previews.

### What it does

- Reads MP4, MOV, WebM, MKV, AVI and most other formats that ffmpeg reads (H.264, HEVC, VP9, AV1 and more).
- Five ways to choose frames:
  - **Evenly spaced:** a number of frames spread over the whole video.
  - **Every N seconds:** one frame per interval, starting at 0.
  - **Exact times:** a list of times in seconds or hh:mm:ss.
  - **Scene changes:** keyframes whose picture differs from the one before.
  - **Every keyframe:** all keyframes in the video.
- Scales frames down to a maximum width, 1280 px by default, or keeps the original size.
- Turns phone videos upright from the rotation stored in the file.
- Saves an optional contact sheet per video, free of charge.
- Evenly spaced, interval and exact-time frames read only the parts of the file they need. A 3 GB 4K file does not have to be downloaded in full.

Frames are extracted inside the container with [FFmpeg](https://ffmpeg.org/). Your videos go to no outside service.

### Input: video file links or your own uploads

You can give videos in two ways:

1. **Video file URLs.** Paste direct links to video files, one per line. The Actor reads robots.txt on each host.
2. **Key-value store.** Upload video files to one of your Apify key-value stores and pick it in the input. The Actor only reads that store.

Links to pages on YouTube, TikTok, Instagram, Facebook, X, Vimeo and similar platforms are refused. Their terms forbid downloading. A link that returns a web page is refused too. Use links to the video file itself.

With no input, the Actor processes a built-in 20-second sample video made of ffmpeg test patterns, so a test run always works.

### How to extract frames from a video

1. Paste direct video links in **Video file URLs**, or pick a key-value store with your files.
2. Pick **Which frames**: evenly spaced, every N seconds, exact times, scene changes or every keyframe.
3. Set the number of frames, the interval or the times for that mode.
4. Optional: change the image format, the maximum width, or turn on the contact sheet.
5. Click **Start**. Open the **Frame images** tab, or use the `frameUrl` link in each row.

### Output

Each frame is saved in the run's key-value store and gets one dataset row.

| Field | Meaning |
|---|---|
| `status` | `ok` for a frame, `failed` for a video that could not be read |
| `error` | Why the video failed. Null for frames |
| `videoUrl` / `keyValueStoreKey` | Where the video came from |
| `mode` | How frames were chosen |
| `frameIndex` | Position of the frame in this video, from 0 |
| `timestampSecs`, `timecode` | Time of the frame, in seconds and as hh:mm:ss.mmm |
| `frameWidth`, `frameHeight`, `frameBytes`, `format` | The frame image |
| `frameKey`, `frameUrl` | Key and download link of the frame image |
| `videoDurationSecs`, `videoWidth`, `videoHeight`, `videoFps` | The video |
| `videoCodec`, `videoContainer`, `videoBitRate`, `videoSizeBytes`, `videoRotation` | More video facts from ffprobe |
| `windowStartSecs`, `windowEndSecs` | The part of the video used, when you set a start or end time |
| `frameBrightness`, `shiftedBySecs` | Brightness of the frame (0 to 255) and how far it moved to step past a black frame |

Sample record from a local test run (built-in sample video, 10 evenly spaced frames):

```json
{
    "status": "ok",
    "source": "sample",
    "keyValueStoreKey": "sample-scenes.mp4",
    "videoId": "be545977c999382c",
    "mode": "count",
    "frameIndex": 4,
    "timestampSecs": 8.977,
    "timecode": "00:00:08.977",
    "frameWidth": 640,
    "frameHeight": 360,
    "frameBytes": 7539,
    "format": "jpeg",
    "frameKey": "sample-scenes-be5459-000008977ms.jpg",
    "contentType": "image/jpeg",
    "videoDurationSecs": 20,
    "videoWidth": 640,
    "videoHeight": 360,
    "videoFps": 25,
    "videoCodec": "h264",
    "videoContainer": "mov,mp4,m4a,3gp,3g2,mj2",
    "videoBitRate": 1316234,
    "videoSizeBytes": 3290585,
    "videoRotation": 0
}
```

The record has more fields, such as `id`, `frameUrl` and `scrapedAt`. Fields that do not apply are null.

### Input options

| Option | Default | Meaning |
|---|---|---|
| Video file URLs | None (sample video) | Direct links to video files |
| Key-value store | None | Your store with video files |
| Record keys | All | Only these records of the store |
| Which frames | Evenly spaced | Evenly spaced, every N seconds, exact times, scene changes or every keyframe |
| Number of frames | 10 | For evenly spaced frames |
| Seconds between frames | 10 | For one frame every N seconds |
| Times | None | For exact times: 75.5 or 00:01:15.5 |
| Start time, End time | Whole video | Use only this part of each video, in every mode. Scans charge only the minutes inside it |
| Skip black and blank frames | On | Step past black, white or one-colour frames, up to 1.5 s forward. Skipped frames are free |
| Scene change sensitivity | 0.3 | 0.01 to 1. Lower finds more changes |
| Maximum frames per video | 50 | A cap in every mode |
| Maximum frame width | 1280 px | 0 keeps the original size |
| Image format | JPEG | JPEG, PNG or WebP |
| Quality | 85 | For JPEG and WebP |
| Contact sheet | Off | One grid image per video, free |
| Maximum video length for scans | 30 minutes | Scene and keyframe scans skip longer videos |
| Maximum frames per run | 200 | Set 0 for no limit |

### Scene changes and keyframes

Scene detection compares keyframes, not every frame. That keeps a scan fast and cheap, but a cut is reported at the first keyframe after it. Most videos have a keyframe every 1 to 10 seconds. Scans read the whole video file, so they also charge per started minute of video.

### Pricing

You pay per saved frame, plus a small start fee per run. Failed videos are free.

- **Frame extracted:** every saved frame.
- **HD source surcharge:** added per frame when the video is larger than 1280 x 720, such as 1080p. Decoding a larger picture costs more.
- **4K source surcharge:** added per frame, on top of the HD surcharge, when the video is larger than 2560 x 1440.
- **Video minute scanned:** scene-change and keyframe modes read the whole video, so they also charge per started minute of video. The charge is made after the scan finishes.

| Event | Price |
|---|---|
| Run start | $0.005 |
| Frame extracted | $0.002 ($2.00 per 1,000) |
| HD source surcharge | $0.002 ($2.00 per 1,000) |
| 4K source surcharge | $0.012 ($12.00 per 1,000) |
| Video minute scanned | $0.002 ($2.00 per 1,000) |

| Frames in one run | Cost, start fee included |
|---|---|
| 100 | $0.21 |
| 1,000 | $2.01 |

Costs are rounded up to the cent. They are for the count, interval and timestamps modes on videos up to 1280 x 720. Larger videos add the surcharges above. The scenes and keyframes modes add the per-minute charge.

### Limits

- Runs use 512 MB. One video is processed at a time.
- Scans skip videos longer than the maximum video length you set (30 minutes by default, up to 600). In tests at 512 MB, a 10-minute 360p scan took about 9 minutes and a 4K frame took about 50 seconds.
- The default run timeout is 1 hour. When a run nears its timeout, the remaining videos are marked failed (free) and the run ends cleanly.
- Videos from your key-value store can be up to 2 GB.
- Each frame request has a 3-minute limit, so one broken file cannot stall the run.

### Your videos and rights

You choose the videos and must have the right to process them. Frames are stored only in your own Apify storage.

### FAQ

**Can I use a YouTube or TikTok link?**
No. Those platforms forbid downloading in their terms. Use a direct link to a video file you have the right to use, or upload the file to a key-value store.

**Why are my scene-change times a little after the real cut?**
Changes are detected on keyframes. The frame shown is the first keyframe after the cut.

**Can I call it from an AI agent?**
Yes. Call the Actor through the Apify API, MCP, Make, n8n or Zapier with video links, then read the dataset or the frame files. The default 1280 px width suits vision models.

# Actor input Schema

## `videoUrls` (type: `array`):

Direct links to video files, one per line: MP4, MOV, WebM, MKV, AVI and most other formats ffmpeg reads. Pages on YouTube, TikTok, Instagram and similar platforms are refused, because their terms forbid downloading. The Actor reads robots.txt on each host. Leave empty, with no key-value store, to process a built-in sample video.

## `keyValueStoreId` (type: `string`):

Optional. Pick one of your key-value stores that holds uploaded video files. The Actor only reads this store. Frames go to the run's own key-value store.

## `keyValueStoreKeys` (type: `array`):

Optional. Process only these records of the store. Leave empty to process every record.

## `mode` (type: `string`):

Evenly spaced and interval frames read only the parts of the video they need. Scene changes and keyframes read the whole video and also charge per scanned minute.

## `frameCount` (type: `integer`):

For 'evenly spaced': how many frames per video.

## `intervalSeconds` (type: `number`):

For 'every N seconds': the gap between frames, starting at 0.

## `timestamps` (type: `array`):

For 'exact times': seconds (75.5) or hh:mm:ss (00:01:15.5), one per line. Times past the end of a video are skipped.

## `startTime` (type: `string`):

Optional. Use only the part of each video from this time: seconds (75.5) or hh:mm:ss (00:01:15.5). Empty means from the start. Scene and keyframe scans then charge only the minutes inside the window.

## `endTime` (type: `string`):

Optional. Use only the part of each video up to this time. Empty means to the end.

## `skipBlankFrames` (type: `boolean`):

Step past black, white or one-colour frames, up to 1.5 seconds forward. A slot with only blank frames is skipped. Skipped frames are free. Exact times are never moved.

## `sceneThreshold` (type: `number`):

For 'scene changes': 0.01 to 1. Lower finds more scene changes. 0.3 suits most videos. Changes are detected between keyframes, which keeps scans fast.

## `maxFramesPerVideo` (type: `integer`):

A cap on frames from one video in any mode.

## `maxWidth` (type: `integer`):

Frames wider than this are scaled down, keeping proportions. 0 keeps the original size. 1280 suits AI vision models and previews.

## `outputFormat` (type: `string`):

Format of the frame images.

## `quality` (type: `integer`):

Quality for JPEG and WebP, from 1 to 100.

## `contactSheet` (type: `boolean`):

Also save one grid image per video with all its frames, 4 across. Free of charge.

## `maxVideoMinutes` (type: `integer`):

Scene and keyframe scans skip videos longer than this. A 10-minute 360p video took about 9 minutes to scan at 512 MB, so long scans need a longer run timeout. Other modes have no length limit.

## `maxItems` (type: `integer`):

Stop after saving this many frames in total. Set 0 for no limit.

## Actor input object example

```json
{
  "videoUrls": [],
  "keyValueStoreKeys": [],
  "mode": "count",
  "frameCount": 10,
  "intervalSeconds": 10,
  "timestamps": [],
  "skipBlankFrames": true,
  "sceneThreshold": 0.3,
  "maxFramesPerVideo": 50,
  "maxWidth": 1280,
  "outputFormat": "jpeg",
  "quality": 85,
  "contactSheet": false,
  "maxVideoMinutes": 30,
  "maxItems": 200
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "videoUrls": [],
    "maxItems": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("maliksaid/video-frame-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "videoUrls": [],
    "maxItems": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("maliksaid/video-frame-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "videoUrls": [],
  "maxItems": 200
}' |
apify call maliksaid/video-frame-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,maliksaid/video-frame-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Q64OQMbwA7sCIxnpc/builds/RAkgmCjPG5hxvys6E/openapi.json
