# Video Frame Extractor: Extract Frames from Video, No Duplicates (`northbell/video-frame-extractor`) Actor

Extract still frames from video file links (mp4, mov, webm, mkv). Scene changes, fixed intervals or exact timestamps. Near-duplicate and blurry frames are dropped before you pay.

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

## Pricing

from $2.40 / 1,000 frames

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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: Extract Frames from Video, No Duplicates

**Still frames from your video files, as image links.** Give it direct links to video files (mp4, mov, webm, mkv, m4v, avi); get one image per scene change, per interval, or at the exact times you list. Near-duplicate and blurry frames are dropped before you pay, so every frame is a different, sharp picture. $3.00 per 1,000 frames.

**Try it now — the input is already filled in.** Press **Start**: you get one frame per second of two short public sample clips (MDN's CC0 examples) — 12 candidates, 8 kept, 4 near-duplicates dropped and not charged (our own run, 21 Nov 2026), about $0.024. Each row is one kept frame; one more row per video says how many candidates were dropped and why. Two of the rows from that run on Apify (the image link is shortened):

```json
{
  "type": "frame",
  "videoUrl": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
  "frameIndex": 2,
  "timeSec": 2,
  "timecode": "00:00:02.000",
  "imageUrl": "https://api.apify.com/v2/key-value-stores/…/records/d2999480117c-2.jpg",
  "width": 960,
  "height": 540,
  "sharpness": 302.3,
  "hash": "29536225561673f2"
}
```

```json
{
  "type": "video",
  "videoUrl": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/friday.mp4",
  "status": "done",
  "reason": null,
  "durationSec": 6.2,
  "candidates": 7,
  "keptFrames": 5,
  "droppedDuplicates": 2,
  "droppedBlurry": 0,
  "contactSheetUrl": null
}
```

Near-duplicate and blurry frames are dropped before you pay, so every frame is a different, sharp picture. Your video is processed only inside this Actor's run on Apify; nothing is sent to other services. It can also run automatically after your scraper and pick up only new videos.

### What you pay

- **$0.003 per kept frame** (the `frame` event), plus $0.00005 per run start.
- Dropped frames, skipped links and failed videos are free.
- The optional contact sheet (one grid image of the kept frames) counts as one frame.
- Set "Maximum total charge" on the run as your cap. The Actor works out how many frames still fit before it saves them and stops cleanly at the limit; everything saved is in the dataset.

### How it works

1. The Actor downloads each video into the run's temporary disk (max 2 GB per file).
2. It picks candidate frames with ffmpeg.
3. For each candidate it computes a sharpness score and a 64-bit picture hash. A candidate is dropped when
   - **blurry**: its sharpness is below "Minimum sharpness" (variance of the Laplacian on a 160 px wide grey copy; default 40), or
   - **near-duplicate**: its hash differs from the last kept frame in "Duplicate distance" bits or fewer (default 6).
4. Kept frames are saved to the run's key-value store, and each row carries the public image link.

Blur is checked first, so a blurry frame never becomes the picture the next frame is compared with. A completely flat frame (a black or single-colour screen) has no detail and counts as blurry; set "Minimum sharpness" to 0 to keep such frames.

### Modes

| Mode | What you get |
| --- | --- |
| `scenes` (default) | The first frame plus a frame at every scene change. Raise or lower "Scene change threshold" (default 0.3; lower finds more changes). |
| `interval` | One candidate every "Every N seconds" (default 10), starting at 0. |
| `times` | Candidates at the exact moments in "Timestamps", as seconds (`74.2`) or `hh:mm:ss` (`00:01:14`). Times past the end of the video are ignored and noted in the video row. |

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `videoUrls` | none | Direct links to video files. Up to 200 per run. Needed unless you give `datasetId`. |
| `datasetId` | none | Read video links from this Apify dataset (for example a scraper's run dataset). |
| `urlField` | auto | Field holding the link. If empty, each item is checked for `videoUrl`, `video_url`, `url`, `link`, `downloadUrl`, `mediaUrl`, `src`; the first with a link ending in a video extension is used, else the first with any http(s) link. |
| `maxVideos` | 50 | Cap on videos per run, counting `videoUrls` and the dataset together (duplicates removed). |
| `mode` | `scenes` | `scenes`, `interval` or `times`. |
| `sceneThreshold` | 0.3 | Scenes mode: 0 to 1, lower finds more changes. |
| `everySeconds` | 10 | Interval mode. |
| `timestamps` | none | Times mode. |
| `dropDuplicates` | true | Drop near-duplicate frames. |
| `duplicateDistance` | 6 | Bits of difference (0 to 32) at or below which a frame counts as a duplicate. |
| `dropBlurry` | true | Drop blurry frames. |
| `minSharpness` | 40 | Sharpness score below which a frame is blurry. 0 turns the check off. |
| `maxFrames` | 50 | Frames kept per video, at most (1 to 500). |
| `format` | `jpg` | `jpg`, `png` or `webp`. |
| `width` | keep | Resize to this width in pixels; the height follows. |
| `contactSheet` | false | Also save one grid image of the kept frames per video. |
| `onlyNewSinceLastRun` | false | Skip links you processed in an earlier run (remembered by link for 90 days). |

### Run it after your scraper

If you have a scraper that collects links to video files, this Actor can run by itself after every scraper run:

1. In Apify Console, open your scraper and go to **Integrations**.
2. Add **Run Actor** and pick this Actor.
3. Use this input:

```json
{
  "datasetId": "{{resource.defaultDatasetId}}",
  "onlyNewSinceLastRun": true,
  "mode": "scenes"
}
```

Each scraper run then hands over its video links, the Actor skips the ones it has already seen, and you pay only for the frames of new videos. Video-site links in the dataset come back as skipped, free. If the dataset is empty, nothing runs and nothing is charged.

A daily schedule works the same way with a fixed `datasetId`, for example a named dataset your scraper keeps appending to.

### Output

One row per kept frame (`type: "frame"`) and one summary row per video (`type: "video"`).

- Frame rows: `videoUrl`, `frameIndex`, `timeSec`, `timecode`, `imageUrl`, `width`, `height`, `sharpness`, `hash`.
- Video rows: `videoUrl`, `status` (`done`, `failed`, `skipped` or `no_frames`), `reason`, `durationSec`, `candidates`, `keptFrames`, `droppedDuplicates`, `droppedBlurry`, `contactSheetUrl`.

Images are stored in the run's default key-value store as `<12 characters of the link's hash>-<index>.<format>`. They stay as long as your Apify storage retention keeps the run.

### Limits

- **Links to video sites are not supported; give a direct file link.** YouTube, TikTok, Instagram, Facebook, X (Twitter), Vimeo, Twitch, Bilibili and Douyin links come back as `skipped` and are free.
- Maximum file size 2 GB. The link must be reachable without a login.
- At most 400 candidate frames are examined per video. Long videos in `interval` mode with a small step are cut there; use a larger step or `times`.
- Only frames, not audio or subtitles.
- You are responsible for having the right to process the videos you give it.

### 日本語

動画ファイルへの直リンク(mp4・mov・webm・mkv など)から、場面転換・一定間隔・指定時刻の静止画を取り出します。ほぼ同じ画像とボケた画像は課金の前に捨てるので、受け取る1枚1枚が別の絵で、くっきりしています。料金は1枚 $0.003。捨てた画像・対応外リンク・失敗した動画は無料です。YouTube などの動画サイトのリンクは対応しません(直リンクを指定してください)。動画はこの Actor の実行の中だけで処理され、外部のサービスには送られません。

# Actor input Schema

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

Direct links to video files, or leave empty and give a Dataset ID (mp4, mov, webm, mkv, m4v, avi), up to 2 GB each. Links to video sites (YouTube, TikTok, Instagram, Facebook, X, Vimeo, Twitch, Bilibili, Douyin) are not supported and come back as skipped, free.

## `datasetId` (type: `string`):

Read video links from this Apify dataset (e.g. the dataset of a scraper run). Use {{resource.defaultDatasetId}} when you connect this Actor as an integration after another Actor.

## `urlField` (type: `string`):

Name of the field that holds the link. If empty, each item is checked for videoUrl, video_url, url, link, downloadUrl, mediaUrl, src (in that order): the first with a link ending in a video extension is used, else the first with any http(s) link.

## `maxVideos` (type: `integer`):

Cap on videos per run, counting the links above and the dataset together.

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

Scene changes: a frame whenever the picture changes a lot (plus the first frame). Every N seconds: one frame per interval. Exact timestamps: the moments you list.

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

Scenes mode only. 0 to 1; lower finds more changes. 0.3 suits most videos.

## `everySeconds` (type: `number`):

Interval mode only.

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

Times mode only. Seconds (12.5) or hh:mm:ss (00:01:30).

## `dropDuplicates` (type: `boolean`):

Drop a frame that looks almost the same as the last frame kept. Dropped frames are free.

## `duplicateDistance` (type: `integer`):

A frame is a duplicate if its 64-bit picture hash differs from the last kept frame in this many bits or fewer. Higher drops more.

## `dropBlurry` (type: `boolean`):

Drop frames whose sharpness score is below the minimum. Dropped frames are free.

## `minSharpness` (type: `number`):

Sharpness score (variance of the Laplacian on a 160 px wide grey copy). 0 turns the check off.

## `maxFrames` (type: `integer`):

Frames kept and charged per video, at most.

## `format` (type: `string`):

File type of the saved frames. JPG is smallest; PNG keeps every pixel; WebP is small and sharp.

## `width` (type: `integer`):

Leave empty to keep the video's own size. The height follows.

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

Also save one grid image of the kept frames per video. Charged as one frame.

## `onlyNewSinceLastRun` (type: `boolean`):

Skip video links you already processed in an earlier run of this Actor (remembered by link).

## Actor input object example

```json
{
  "videoUrls": [
    "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
    "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/friday.mp4"
  ],
  "maxVideos": 50,
  "mode": "interval",
  "sceneThreshold": 0.3,
  "everySeconds": 1,
  "dropDuplicates": true,
  "duplicateDistance": 6,
  "dropBlurry": true,
  "minSharpness": 40,
  "maxFrames": 50,
  "format": "jpg",
  "contactSheet": false,
  "onlyNewSinceLastRun": false
}
```

# Actor output Schema

## `frames` (type: `string`):

Kept frames with time, image link and scores.

## `videos` (type: `string`):

One summary row per video: status and how many frames were dropped and why.

# 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": [
        "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
        "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/friday.mp4"
    ],
    "mode": "interval",
    "everySeconds": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("northbell/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": [
        "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
        "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/friday.mp4",
    ],
    "mode": "interval",
    "everySeconds": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("northbell/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": [
    "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
    "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/friday.mp4"
  ],
  "mode": "interval",
  "everySeconds": 1
}' |
apify call northbell/video-frame-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,northbell/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/P0U23Lu2brAxFPiHh/builds/buSwPltythDwHYSk7/openapi.json
