# Video Frame Extractor: Extract Frames from Video URLs (`venture_ace/video-frame-extractor`) Actor

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 files at direct URLs with ffmpeg: every N seconds, every Nth frame, at scene changes, or at exact timestamps. Frames go to the key-value store (JPG or PNG) with one dataset row each.

### Input

- `videoUrls`: direct video file URLs, up to 20 (page URLs such as YouTube are refused with a reason).
- `mode`: `interval` (default), `everyNth`, `sceneChange`, `timestamps`; with `intervalSeconds`, `everyNthFrame`, `sceneThreshold`, `timestamps`.
- `imageFormat` (`jpg`/`png`), `maxWidth`, `jpegQuality`.
- `maxFramesPerVideo` (default 50), `maxFramesTotal` (default 100).

### Output

One row per frame: `videoUrl`, `status` (`ok`), `frameIndex`, `timestamp`, `timestampSec`, `url`, `width`, `height`, `sizeBytes`. A video that cannot be processed gets one row with `status` `fetch_failed`, `unreadable`, `no_frames`, `failed` or `skipped` and an `error` reason; the run still succeeds. A note (frame cap reached, timestamp past the end, time limit) is on the last row's `error`.

Pay per event: US$0.002 per frame delivered. Direct file URLs only; localhost and private addresses are refused. Licence: ffmpeg is LGPL/GPL as packaged by Debian and run as a separate program.

# Actor input Schema

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

Direct links to video files (mp4, webm, mov, mkv and anything ffmpeg reads), one per line, up to 20 per run. Page links (YouTube, TikTok, Instagram and similar) are refused with a per-video error. Localhost and private addresses are refused. Max 500 MB per file.

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

interval: one frame every N seconds. everyNth: every Nth video frame. sceneChange: the first frame plus a frame at each cut. timestamps: exact times you list.

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

One frame every this many seconds, starting at 0.

## `everyNthFrame` (type: `integer`):

Keep every Nth decoded frame, starting with the first.

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

0.05 to 0.95. Lower finds more cuts (0.3 is a good start for most video).

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

Seconds (12.5) or clock time (1:30, 00:01:30.5), one per line. A time past the end of the video is skipped with a note.

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

jpg is smaller; png is lossless and much larger.

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

Frames wider than this are scaled down, keeping the aspect ratio. Frames are never scaled up.

## `jpegQuality` (type: `integer`):

10 to 100 (jpg only).

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

Safety cap per video. Extraction stops there and the last row notes it.

## `maxFramesTotal` (type: `integer`):

Safety cap on all frames in this run (and so on what the run can charge). Videos after it are returned with status skipped.

## Actor input object example

```json
{
  "videoUrls": [
    "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
  ],
  "mode": "interval",
  "intervalSeconds": 5,
  "everyNthFrame": 30,
  "sceneThreshold": 0.3,
  "timestamps": [],
  "imageFormat": "jpg",
  "maxWidth": 1280,
  "jpegQuality": 85,
  "maxFramesPerVideo": 50,
  "maxFramesTotal": 100
}
```

# Actor output Schema

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

One row per extracted frame: video, time, image URL, size. Failed videos get one row with a status and reason.

## `images` (type: `string`):

The extracted image files in the key-value store.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("venture_ace/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"] }

# Run the Actor and wait for it to finish
run = client.actor("venture_ace/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"
  ]
}' |
apify call venture_ace/video-frame-extractor --silent --output-dataset

```

## MCP server setup

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