# Video Frame Extractor: MP4 to JPG, Scene Frames, Thumbnails (`picdev/video-frame-extractor-mp4-to-jpg`) Actor

Extract frames from video files by URL: one frame every N seconds, N evenly spaced frames, scene changes, keyframes or exact timestamps. MP4, MOV, WEBM, MKV, M3U8 to JPG, PNG or WEBP with image links, a contact sheet and a ZIP. $1 per 1,000 frames.

- **URL**: https://apify.com/picdev/video-frame-extractor-mp4-to-jpg.md
- **Developed by:** [PIC DEV](https://apify.com/picdev) (community)
- **Categories:** Developer tools, Videos, AI
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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.

Learn more: https://docs.apify.com/actors/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: MP4 to JPG, Scene Frames, Thumbnails

**Extract frames from a video** by URL and get them back as image links. Pick one frame every N seconds, N evenly spaced frames, one frame per scene change, the video's keyframes, or the exact timestamps you list. Works with direct links to MP4, MOV, WEBM, MKV, AVI and M3U8 (HLS) files. Output is JPG, PNG or WEBP, plus a contact sheet and an optional ZIP per video.

No ffmpeg to install, no server to run, no API key. **$1 per 1,000 frames**, and videos that fail are free.

### What does Video Frame Extractor do?

It opens each video link, reads its duration, resolution, frame rate and codec, and saves the frames you asked for. The video is read over HTTP range requests and only the parts around the requested frames are decoded, so ten thumbnails from a one-hour MP4 take a few seconds and the file is never downloaded in full. Scene detection is the exception: it has to decode the whole selected range.

### Frame extraction modes

| Mode | What you get | Good for |
|---|---|---|
| `count` (default) | N frames spread evenly across the video, each from the middle of an equal slice | Thumbnails, previews, frames for a vision model |
| `interval` | One frame every N seconds (`5`, or `0.5` for two per second) | Lectures, screen recordings, CCTV, datasets |
| `scenes` | One frame at each cut, with a sensitivity threshold and a `sceneScore` | Storyboards, ad and trailer breakdowns |
| `keyframes` | The video's own I-frames | Fast sampling exactly as the encoder placed them |
| `timestamps` | The exact times you list: `90`, `1:30`, `00:01:30.250`, `1m30s` | Grabbing moments you already know |

`startTime` and `endTime` limit every mode except `timestamps`. `maxFramesPerVideo` caps the output and the cost.

### Use cases

- **Video to images for AI vision models.** GPT, Claude and Gemini read images, not video. Send 8 to 20 evenly spaced or scene frames and ask for a summary, tags or moderation.
- **Video thumbnails.** Pull candidates from a product clip, a course lesson or a webinar and pick the best still.
- **Storyboards and contact sheets.** One grid image per video shows the whole thing at a glance.
- **Computer vision datasets.** Sample footage at a fixed rate into JPG or lossless PNG.
- **Video QA.** Check a batch of exports for wrong intros, missing slates or black frames without opening each file.
- **Slides from a lecture recording.** Scene mode on a screen recording returns one image per slide change.

### Input

```json
{
  "videoUrls": ["https://media.w3.org/2010/05/sintel/trailer.mp4"],
  "mode": "scenes",
  "sceneThreshold": "0.3",
  "maxFramesPerVideo": 50,
  "imageFormat": "jpg",
  "maxWidth": 1280,
  "zipFrames": true
}
```

| Field | Default | Notes |
|---|---|---|
| `videoUrls` | required | Direct links to video files. The link must open without a login. |
| `mode` | `count` | `count`, `interval`, `scenes`, `keyframes` or `timestamps`. |
| `frameCount` | 10 | Count mode. |
| `intervalSeconds` | 5 | Interval mode. Fractions are fine. |
| `timestamps` | none | Timestamps mode. Times past the end are ignored. |
| `sceneThreshold` | 0.3 | Scenes mode, 0.01 to 0.99. Lower finds more cuts. |
| `minSceneGapSeconds` | 1 | Scenes mode. Minimum distance between saved frames. |
| `startTime`, `endTime` | none | Seconds, `1:30` or `1m30s`. |
| `maxFramesPerVideo` | 100 | Up to 5,000. |
| `imageFormat` | `jpg` | `jpg`, `png` or `webp`. |
| `imageQuality` | 85 | JPG and WEBP. |
| `maxWidth` | original | Scales wider frames down. |
| `contactSheet` | true | One grid image per video, up to 40 thumbnails. |
| `zipFrames` | false | One ZIP per video with all frames. |

### Output

One row per frame:

```json
{
  "type": "frame",
  "videoUrl": "https://media.w3.org/2010/05/sintel/trailer.mp4",
  "videoIndex": 1,
  "frameIndex": 4,
  "timestampSec": 23.792,
  "timestamp": "00:00:23.792",
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v001-f0004.jpg?signature=<...>",
  "key": "v001-f0004.jpg",
  "width": 854,
  "height": 480,
  "imageFormat": "jpg",
  "sizeBytes": 41701,
  "sceneScore": 0.673
}
```

And one free summary row per video:

```json
{
  "type": "video",
  "videoUrl": "https://media.w3.org/2010/05/sintel/trailer.mp4",
  "videoIndex": 1,
  "status": "ok",
  "durationSec": 52.208,
  "width": 854,
  "height": 480,
  "fps": 24.0,
  "codec": "h264",
  "framesExtracted": 8,
  "contactSheetUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v001-contact-sheet.jpg",
  "zipUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v001-frames.zip",
  "processingSec": 1.4
}
```

A link that cannot be processed returns a `video` row with `status: "error"` and a plain reason in `error` (not found, access denied, not a video file, no video stream). Those rows cost nothing.

If the file server drops the connection or starts rate limiting in the middle of a video, the Actor retries twice, then keeps the frames it already saved and marks the video `partial` with the reason in `error`.

Image links are signed, so they open in a browser, a spreadsheet or a vision model without your API token. Images stay in the run's key-value store for as long as your Apify plan keeps run storage. Download the ZIP or copy the images if you need them longer.

### How much does it cost to extract frames from a video?

**$0.001 per saved frame**, which is $1 per 1,000 frames. Summary rows, contact sheets, ZIP archives and failed videos are free. Ten thumbnails from one video cost one cent. Set a maximum charge per run in the Apify run options and the Actor stops when it is reached.

### Extract video frames with the API

```bash
curl -X POST "https://api.apify.com/v2/acts/picdev~video-frame-extractor-mp4-to-jpg/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls":["https://media.w3.org/2010/05/sintel/trailer.mp4"],"mode":"count","frameCount":12}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("picdev/video-frame-extractor-mp4-to-jpg").call(run_input={
    "videoUrls": ["https://media.w3.org/2010/05/sintel/trailer.mp4"],
    "mode": "interval",
    "intervalSeconds": "5",
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    if row["type"] == "frame":
        print(row["timestamp"], row["imageUrl"])
```

### Limits

- **Direct file links only.** YouTube, TikTok and Instagram page links are not supported. Pass the video file itself.
- **Scene detection finds cuts, not fades.** A dissolve or a slow fade between two shots is not reported as a scene change. Black frames between shots are skipped, and the first lit frame after them is saved.
- **Rotation metadata is ignored.** A phone video stored sideways with a rotation flag comes out sideways.
- **HLS (M3U8) seeking is slower** than MP4: expect a few seconds per frame on long streams.
- The server hosting the file should support HTTP range requests. Without them, seeking in a long video means reading it from the start.

### FAQ

**Can I extract a frame every second from an MP4?** Yes. Use `interval` mode with `intervalSeconds` set to `1`, and raise `maxFramesPerVideo` if the video is longer than 100 seconds.

**How do I get one frame per scene?** Use `scenes` mode. Start with the default threshold of 0.3. If shots are missed, lower it to 0.2. If you get near-duplicates in fast action, raise it or increase `minSceneGapSeconds`.

**Which timestamp does a frame get?** The presentation time of the frame actually saved, which is the first frame at or after the time you asked for.

**Can I run it on many videos?** Yes. Pass any number of links in `videoUrls`. Videos are processed one after another and each failure is reported on its own row.

# Actor input Schema

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

Direct links to video files: MP4, MOV, WEBM, MKV, AVI, M3U8 (HLS). Files on S3, R2, GCS, a CDN or your own server work; the link must open without a login. One row per frame comes back.

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

Count: N frames spread evenly across the video. Interval: one frame every N seconds. Scenes: one frame at each cut. Keyframes: the video's own I-frames. Timestamps: the exact times you list.

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

How many frames to take. Each one comes from the middle of an equal slice of the video, so black lead-ins and end credits are avoided.

## `intervalSeconds` (type: `string`):

Seconds between frames, e.g. `5`, or `0.5` for two frames per second.

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

Times to capture: seconds (`90`, `90.5`), clock format (`1:30`, `00:01:30.250`) or `1m30s`. Times past the end of the video are ignored.

## `sceneThreshold` (type: `string`):

How different two consecutive frames must be to count as a cut, from 0.01 to 0.99. Lower finds more scenes, higher keeps only hard cuts. Fades and dissolves are not detected.

## `minSceneGapSeconds` (type: `string`):

Ignore cuts that come sooner than this after the previous saved frame.

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

Optional. Skip everything before this time, e.g. `30`, `0:30` or `1m`. Not used in timestamps mode.

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

Optional. Stop at this time, e.g. `120`, `2:00` or `2m`. Not used in timestamps mode.

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

Hard cap on frames saved (and charged) for one video.

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

JPG is smallest, PNG is lossless, WEBP is in between.

## `imageQuality` (type: `integer`):

30 to 100. Ignored for PNG.

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

Optional. Wider frames are scaled down, keeping the aspect ratio. Leave empty for the original size.

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

Save one grid image with up to 40 thumbnails per video. Free.

## `zipFrames` (type: `boolean`):

Save one ZIP archive with all frames of each video. Free.

## Actor input object example

```json
{
  "videoUrls": [
    "https://media.w3.org/2010/05/sintel/trailer.mp4"
  ],
  "mode": "count",
  "frameCount": 10,
  "intervalSeconds": "5",
  "sceneThreshold": "0.3",
  "minSceneGapSeconds": "1",
  "maxFramesPerVideo": 100,
  "imageFormat": "jpg",
  "imageQuality": 85,
  "contactSheet": true,
  "zipFrames": false
}
```

# Actor output Schema

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

One row per saved frame plus one summary row per video.

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

All files saved by the run.

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

Videos processed, videos skipped and frames extracted.

# 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://media.w3.org/2010/05/sintel/trailer.mp4"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("picdev/video-frame-extractor-mp4-to-jpg").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://media.w3.org/2010/05/sintel/trailer.mp4"] }

# Run the Actor and wait for it to finish
run = client.actor("picdev/video-frame-extractor-mp4-to-jpg").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://media.w3.org/2010/05/sintel/trailer.mp4"
  ]
}' |
apify call picdev/video-frame-extractor-mp4-to-jpg --silent --output-dataset

```

## MCP server setup

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

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/BavJDkdHqKFsiszve/builds/AVtsifJAl8gcbQIoq/openapi.json
