# Video Frame Extractor (direct links) for AI Vision (`asunoki/video-frame-extractor`) Actor

Turn direct video links (MP4, MOV, WebM, MKV, TS, AVI) into still frames: N evenly spaced, one every X seconds, or exact timestamps. $0.003 per video + $0.001 per frame (10 frames = $0.013) + Apify's small start fee. Failed videos and blank frames are free. Not for YouTube/TikTok pages.

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

## Pricing

from $1.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 (direct links) for AI Vision

Turn **direct video links** into still images you can hand to an AI vision model, use as thumbnails, or check by eye.

- **Three ways to pick frames**: N frames spread evenly, one frame every X seconds, or exact timestamps.
- **Only the bytes around each moment are downloaded** (HTTP range seeking), so a 2-hour file does not have to be fetched in full for 10 frames.
- **Blank frames are skipped for free**: a black fade or white flash at the chosen moment steps forward 0.5 s (up to twice); if it is still blank, it is not output and not charged.
- **Pay only for what is delivered.** Failed links, unreadable files, blank frames and out-of-range timestamps are free rows that tell you why.
- **Agent friendly**: one flat row per frame with a direct image link, timecode and size. Optional base64 data URI in the row, so a workflow can pass the frame straight to a vision model.
- **Chain after another Actor**: give a dataset ID and the Actor picks the video link from each row (`videoUrl`, `downloadUrl`, `mediaUrl`, `url` or a field you name).

### What links work

Direct links to video files you own or are allowed to process: MP4, MOV, M4V, WebM, MKV, TS, AVI. For example your own storage, S3 / R2 / GCS signed URLs, a CDN, or Dropbox links ending in `?dl=1`. Make sure you have the rights to the videos you process.

**Not supported:** pages on video platforms (YouTube, TikTok, Instagram, Facebook, X, Vimeo, Twitch and similar) — their terms do not allow downloading, so these links are refused (free). Streaming playlists (HLS `.m3u8`, DASH) are not supported either.

### Safety and limits

- Links are checked before and after every redirect, and again when the connection is made: private, local, link-local and cloud-metadata addresses are refused.
- ffmpeg never contacts your URL directly: it reads through a local checking proxy, so a signed URL's signature never appears in logs or error messages. In output rows, signature-like query values (`X-Amz-Signature`, `token`, `sig`, ...) are shown as `REDACTED`.
- Per video: at most `maxDownloadMbPerVideo` MB fetched (default 200), `maxSecondsPerVideo` seconds (default 300), `maxFramesPerVideo` frames, and the first `maxDurationMinutes` minutes. When a limit stops a video, frames not taken are free.
- No temporary video files: frames are decoded in memory from the bytes around each moment.
- **Who can open the images:** frame links point to this run's key-value store and follow your account's storage access setting. If your account restricts storage access, the links need your API token (`?token=...` or an `Authorization` header); otherwise anyone who has a link can open it. Don't process videos whose frames must stay private without restricted access.

### Try it

The input form is pre-filled with a 10-second sample video made by ASUNOKI for this Actor (a synthetic test pattern with a 1-second black intro, so you can also see blank-frame skipping): `https://asunoki.jp/downloads/video-frame-extractor/sample-10s-640x360.mp4`.

### Input example

```json
{
  "videoUrls": [{ "url": "https://cdn.example.com/product-demo.mp4" }],
  "mode": "count",
  "frameCount": 12,
  "imageFormat": "jpg",
  "maxWidth": 1024
}
```

Exact moments:

```json
{ "videoUrls": [{ "url": "https://cdn.example.com/talk.mp4" }], "mode": "timestamps", "timestamps": ["0:45", "12:30", "1m5s"] }
```

### Output

One dataset row per frame:

```json
{
  "type": "frame",
  "videoUrl": "https://cdn.example.com/product-demo.mp4",
  "frameIndex": 0,
  "time": 2.5,
  "timecode": "00:00:02.500",
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<store>/records/frame-0000-0000.jpg",
  "contentType": "image/jpeg",
  "width": 1024, "height": 576, "bytes": 81234,
  "videoDuration": 30.03, "videoWidth": 1920, "videoHeight": 1080, "videoCodec": "h264"
}
```

Free rows: `type: "video-error"` (with `code`: `platform-page`, `private-address`, `http-403`/`http-404`, `probe-failed`, `no-video`, `too-large`, `no-frames`, ...) and `type: "note"` (timestamps past the end, frame cap, size or time limit reached).

The key-value store holds the images, `frames.csv` and `OUTPUT` (run summary).

### Pricing

Pay per event:

- **`frame-extracted`** for each frame delivered
- **`video-processed`** once per video, only when at least one frame was delivered from it
- plus Apify's small actor-start event

Failed links, unreadable files, blank frames, out-of-range timestamps and videos stopped by a limit before any frame cost nothing. There is no per-minute fee. Set a maximum charge on the run; the Actor stops before going over it.

### Modes in detail

| Mode | What you get |
|---|---|
| `count` (default) | `frameCount` frames, each from the middle of an equal slice of the video (or of `startTime`–`endTime`). Never the very first or last frame. |
| `interval` | `startTime`, `startTime + intervalSeconds`, ... until the end. |
| `timestamps` | Exactly the moments you list (seconds, `1:30`, `00:01:30.250` or `1m30s`). |

`maxFramesPerVideo` caps every mode. `maxDurationMinutes` limits how much of a very long file is used.

### Limits

- No scene-change detection yet (use `count` or `interval`).
- Videos without a known length (live streams) are skipped (free).
- The frame is taken at the nearest decodable point to the requested time; `time` in the row is the moment requested after any blank-frame step.

### Support

Questions or problems: open an issue on this Actor's Issues tab or write to support@asunoki.jp.

# Actor input Schema

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

Direct links to video files you own or are allowed to process: MP4, MOV, M4V, WebM, MKV, TS or AVI (your storage, S3/R2/GCS signed URLs, a CDN, Dropbox ?dl=1). Not supported: video platform pages (YouTube, TikTok, Instagram, Vimeo, ...) whose terms do not allow downloading, streaming playlists (HLS .m3u8, DASH), and links to private or local network addresses.

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

Take video links from another Actor run's dataset (fields videoUrl, downloadUrl, mediaUrl, url or video.\*). Rows without a direct link are ignored for free.

## `datasetField` (type: `string`):

Dot path to the link in each dataset row, e.g. media.src. Leave empty to detect common field names.

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

count: N frames, each from the middle of an equal slice (never the black first/last frame). interval: one frame every X seconds. timestamps: the moments you list.

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

8-20 frames are usually enough for a vision model to understand a video.

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

Interval mode: seconds between frames, starting at the start time. 0.5 = two frames per second.

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

Seconds (90, 90.5), clock format (1:30, 00:01:30.250) or 1m30s. Times past the end of a video are skipped for free.

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

Optional, e.g. 30, 0:30 or 1m. Applies to count and interval modes.

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

Optional, e.g. 300 or 5:00. Empty = end of the video.

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

Hard cap in every mode, so a long video cannot produce more frames than you expect.

## `imageFormat` (type: `string`):

JPG is smallest and works everywhere; WEBP is smaller at the same quality; PNG is lossless and larger.

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

Wider frames are scaled down (aspect ratio kept, never scaled up). 0 = original size.

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

Compression quality for JPG and WEBP (higher = sharper and bigger files).

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

When a chosen frame is one flat colour (black fade, white flash), step forward 0.5 s up to twice. Still blank = skipped and not charged.

## `inlineDataUri` (type: `boolean`):

Adds the image as a base64 data URI to each dataset row, so an AI agent or workflow can pass it straight to a vision model. Keep maxWidth small (e.g. 512) when this is on.

## `maxDurationMinutes` (type: `integer`):

Safety limit for very long files: frames are only taken from the first N minutes (from the start).

## `maxDownloadMbPerVideo` (type: `integer`):

Safety limit on the bytes fetched for one video (all frames together). Only the parts around each moment are read, so 10-20 frames of a 1080p video usually need 20-40 MB. Over the limit, the video stops and the remaining frames are not charged.

## `maxSecondsPerVideo` (type: `integer`):

Stops taking frames from one video after this time; frames not taken are not charged.

## Actor input object example

```json
{
  "videoUrls": [
    {
      "url": "https://asunoki.jp/downloads/video-frame-extractor/sample-10s-640x360.mp4"
    }
  ],
  "mode": "count",
  "frameCount": 3,
  "intervalSeconds": 5,
  "maxFramesPerVideo": 50,
  "imageFormat": "jpg",
  "maxWidth": 1280,
  "quality": 85,
  "skipBlankFrames": true,
  "inlineDataUri": false,
  "maxDurationMinutes": 180,
  "maxDownloadMbPerVideo": 200,
  "maxSecondsPerVideo": 300
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

## `csv` (type: `string`):

No description

## `images` (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": [
        {
            "url": "https://asunoki.jp/downloads/video-frame-extractor/sample-10s-640x360.mp4"
        }
    ],
    "frameCount": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("asunoki/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": [{ "url": "https://asunoki.jp/downloads/video-frame-extractor/sample-10s-640x360.mp4" }],
    "frameCount": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("asunoki/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": [
    {
      "url": "https://asunoki.jp/downloads/video-frame-extractor/sample-10s-640x360.mp4"
    }
  ],
  "frameCount": 3
}' |
apify call asunoki/video-frame-extractor --silent --output-dataset

```

## MCP server setup

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