# Video Scene Detector - Shot Cuts, Keyframes, EDL & Clips (`freecamp008/video-scene-detector`) Actor

Detect scene changes and shot boundaries in any video URL: hard cuts, fades, dissolves and wipes with timecodes, a keyframe image per scene, CSV and EDL export, and optional split clips. Runs on CPU with ffmpeg, no external APIs.

- **URL**: https://apify.com/freecamp008/video-scene-detector.md
- **Developed by:** [Camp8 fr0](https://apify.com/freecamp008) (community)
- **Categories:** Videos, For creators, AI
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 video processeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Scene Detector: Shot Boundary Detection, Keyframes, EDL & Scene Clips

Detect **scene changes and shot boundaries** in any video from a URL. The Actor finds **hard cuts, fades through black or white, cross-dissolves and wipes**. For each video you get a timecoded scene list, a **keyframe image for every scene**, **CSV and EDL (CMX3600) exports**, and, if you want them, the video **split into one clip per scene**. Everything runs inside the Actor with ffmpeg and its own CPU detector. No external APIs are called, so your videos are never sent to a third-party service.

### What does Video Scene Detector do?

- Downloads each video and decodes every frame once at low resolution (128x72) for analysis
- Measures, for every frame:
  - colour (HSV) change
  - colour-histogram distance
  - picture-structure correlation
  - brightness
- Finds **hard cuts** with an **adaptive threshold**: a frame must change much more than its neighbours, so fast action and camera moves are not counted as cuts. Camera flashes and single glitch frames are rejected automatically.
- Finds **fades** (to black or white and back). The new scene starts exactly where the fade-in begins.
- Finds **dissolves, wipes and slides** with a two-scale window test (~0.4 s and ~1 s):
  - Is this frame a blend of the frames before and after it?
  - Are those two frames from unrelated shots?
- Saves the **sharpest, non-blank frame** of each scene as a JPEG, PNG or WebP keyframe
- Exports the scene list as **CSV** (PySceneDetect-style columns) and as an **EDL** that Premiere Pro, DaVinci Resolve and Avid can import
- Optionally **cuts the video into scene clips**. Lossless stream copy is used when a scene starts on a keyframe; otherwise the clip is re-encoded frame-accurately.

### Key features

- **Cuts, fades, dissolves and wipes**: every scene has a `transitionIn` of `cut`, `fade`, `dissolve`, `gradual` (wipe/slide) or `start`
- **Precise timecodes**: start/end in seconds, `HH:MM:SS.mmm`, SMPTE `HH:MM:SS:FF` and frame numbers, based on real frame timestamps (variable frame rate safe)
- **Keyframe thumbnails**: one representative image per scene, with public URLs
- **Editor-ready exports**: CSV scene list and CMX3600 EDL
- **Scene clips**: auto (frame-accurate, copy where possible), stream copy (fastest) or re-encode (H.264/AAC MP4)
- **Works on real-world media**:
  - Formats: MP4, MOV, MKV, WEBM, AVI, OGV, TS, and anything else ffmpeg can read
  - Codecs: H.264, HEVC, VP8/VP9, AV1, Theora, ProRes, MPEG-2...
  - Footage: colour and black-and-white, portrait phone videos, 24-60 fps
- **Better than a plain ffmpeg scene filter**: on hand-labelled test trailers it found 96% of transitions with 96% precision, while ffmpeg's `scdet` reached about 83% / 83% at its best threshold (see FAQ)
- **Private**: no third-party APIs and no AI services. Results go only to your own Apify storage.
- **HTTP API (Standby mode)**: call it like a REST endpoint and get the scene list in the response

### Use cases

- **Video editing**: import the EDL into your NLE as a cut list, or re-edit a finished video from its scene list
- **AI and ML pipelines**: split videos into shots before captioning, embedding, tagging or training data creation (one keyframe per shot instead of one frame per second)
- **Video indexing and search**: build scene-level thumbnails and chapter markers for media libraries
- **Content moderation and review**: check one frame per shot instead of watching the whole video
- **Ad and trailer analysis**: measure editing pace (cuts per minute, average shot length) of ads, trailers and short-form content
- **Archive digitization**: segment old films and broadcasts into shots
- **Highlight and short-form creation**: get scene clips ready for reuse

### How to use Video Scene Detector

#### In Apify Console

1. Click **Try for free** or **Start**.
2. Paste one or more **direct video links** into *Video URLs*. The link has to return the file itself, not a page with a player.
3. Optionally adjust *Detection sensitivity* (Medium suits most videos) and *Minimum scene length*.
4. Turn on *Split video into scene clips* if you need one file per scene.
5. Click **Start**. Every video appears in the **Scene lists** table with its first keyframe. Keyframes, CSV, EDL and clips are listed under **Keyframes, CSV, EDL and clips**.

#### Via the Apify API

```bash
curl -X POST "https://api.apify.com/v2/acts/freecamp008~video-scene-detector/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "videoUrls": ["https://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv"],
    "sensitivity": "medium",
    "keyframes": true,
    "exportEdl": true
  }'
```

You can also use the [apify-client](https://docs.apify.com/api/client/js/) for JavaScript or Python.

#### Standby mode (instant HTTP endpoint)

The Actor also runs as a persistent web server, which saves start-up time on every call. Send the input fields as query parameters (arrays comma-separated) or as a JSON body. The response is `{ "count": n, "items": [...] }`.

```bash
## GET
curl "https://freecamp008--video-scene-detector.apify.actor/?token=YOUR_API_TOKEN&videoUrls=https://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv&sensitivity=high"

## POST
curl -X POST "https://freecamp008--video-scene-detector.apify.actor/?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls": ["https://example.com/my-video.mp4"], "splitClips": true, "splitMode": "auto", "maxClips": 20}'
```

**AI agents** can call this Actor and pay per use with **x402** through Apify. No Apify account or subscription is needed: the agent pays for each call.

### Input example

```json
{
  "videoUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv",
    "https://raw.githubusercontent.com/mediaelement/mediaelement-files/master/big_buck_bunny.mp4"
  ],
  "sensitivity": "medium",
  "minSceneLengthSec": 0.4,
  "detectFades": true,
  "detectDissolves": true,
  "keyframes": true,
  "keyframeFormat": "jpg",
  "keyframeWidth": 640,
  "exportCsv": true,
  "exportEdl": true,
  "splitClips": false,
  "splitMode": "auto",
  "maxClips": 100,
  "maxDurationMinutes": 180
}
```

| Field | Description | Default |
|---|---|---|
| `videoUrls` | Direct links to video files | required |
| `sensitivity` | `low`, `medium` or `high` | `medium` |
| `minSceneLengthSec` | Changes closer than this are merged | `0.4` |
| `detectFades` / `detectDissolves` | Detect fades through black/white, and dissolves/wipes | `true` |
| `keyframes`, `keyframeFormat`, `keyframeWidth`, `maxKeyframes` | Keyframe image per scene: on/off, `jpg`/`png`/`webp`, width in px (0 = original), cap | `true`, `jpg`, `640`, `1000` |
| `exportCsv` / `exportEdl` | Save CSV / CMX3600 EDL | `true` |
| `splitClips`, `splitMode`, `maxClips` | Cut scene clips: `auto`, `copy` or `reencode`; at most N clips | `false`, `auto`, `100` |
| `maxDurationMinutes` | Analyze (and bill) at most this many minutes per video | `180` |
| `analysisMaxFps` | Analyze 50/60 fps videos at this rate (0 = every frame) | `30` |
| `maxFileSizeMB` | Reject larger downloads | `4000` |

### Output example

One dataset item per video (scene list shortened):

```json
{
  "videoUrl": "https://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv",
  "fileName": "Big_Buck_Bunny_Trailer_400p.ogv",
  "durationSec": 33,
  "analyzedSec": 32.52,
  "width": 720,
  "height": 400,
  "fps": 25,
  "videoCodec": "theora",
  "sceneCount": 19,
  "transitionCount": 18,
  "transitions": { "cut": 10, "fade": 6, "dissolve": 2, "gradual": 0 },
  "averageSceneSec": 1.71,
  "cutsPerMinute": 33.21,
  "firstKeyframeUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/scenes-3dcd0e059b3c-kf-0001",
  "csvUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/scenes-3dcd0e059b3c-csv",
  "edlUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/scenes-3dcd0e059b3c-edl",
  "clips": null,
  "scenes": [
    {
      "index": 4,
      "startSec": 9.08,
      "endSec": 11.2,
      "durationSec": 2.12,
      "startTimecode": "00:00:09.080",
      "endTimecode": "00:00:11.200",
      "startSmpte": "00:00:09:02",
      "endSmpte": "00:00:11:05",
      "startFrame": 227,
      "endFrame": 280,
      "transitionIn": "cut",
      "confidence": 0.99,
      "keyframeSec": 10.12,
      "keyframeUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/scenes-3dcd0e059b3c-kf-0004"
    }
  ],
  "billedMinutes": 1,
  "analysisSec": 1.37,
  "processingSec": 3.18,
  "truncated": false,
  "truncatedReason": null
}
```

- **Fade scenes** also have `fadeColor` (`black` or `white`).
- **With clips enabled**, each scene gets `clipUrl`, `clipMode` (`copy` or `reencode`), `clipFormat` and `clipStartSec`, and the item gets a `clips` summary.
- **Long videos:** a video longer than `maxDurationMinutes`, or longer than the remaining run budget covers, is analyzed from the start only and marked `truncated: true`.
- **Failed videos:** a video that can't be downloaded or decoded returns `{ "videoUrl", "error", "isError": true }`, and that item is free.

### Pricing

This Actor uses **pay-per-event** pricing:

| Event | Price | Per 1,000 |
|---|---|---|
| `video-processed`: one video analyzed into a scene list | $0.002 | **$2 per 1,000 videos** |
| `video-minute`: one started minute of analyzed video (rounded up per video) | $0.004 | **$4 per 1,000 minutes** |

**Examples:**

- A 30-second ad costs $0.002 + $0.004 = **$0.006**.
- A 10-minute video costs $0.002 + 10 × $0.004 = **$0.042**.
- A 2-hour film costs **$0.482**.

Keyframes, CSV/EDL exports and clips have no extra event fee. Failed downloads and unreadable files are not charged. Apify platform usage (compute and storage) is billed separately, based on the memory you choose and how long the run takes. Clip splitting, especially re-encoding, and large keyframe sets increase compute and storage.

### FAQ

**How accurate is it?**
Measured on two hand-labelled trailers with 46 transitions in total, at default settings:

- The trailers:
  - *Big Buck Bunny* (CC BY, animation): cuts, dissolves, fades to black and white
  - *Donovan's Brain* (1953, public domain, black-and-white): cuts, wipes, dissolves, fades
- Results:
  - **Recall:** 96% (44 found)
  - **Precision:** 96% (2 false detections, both lightning flashes behind title text)
  - **ffmpeg's `scdet` filter on the same videos:** about 83% precision and 83% recall at its best threshold
- On a synthetic test with 12 known transitions (cuts, 0.5-1.5 s cross-dissolves, fade to black, fade to white, wipe, slide, pixel dissolve), Medium found 11 with no false detections. The one miss, a 1.5 s dissolve into a dark shot, is found on High.

**What does it miss?**

- **Low-contrast dissolves:** very slow dissolves (longer than about 1.5 s) between shots with a similar layout and low contrast can be missed.
- **Same-angle cuts:** a cut between two almost identical shots (same set, same angle) can be missed.
- **Cards on black:** title cards with small text on black are treated as part of a fade.
- **Very short shots:** shots shorter than *Minimum scene length* are merged into their neighbour. Lower the setting (down to 0.1 s) for music videos and fast trailers.
- **Fast action and strobes:** these can occasionally add a cut on High.

**How fast is it, and what are the limits?**

- **Speed:** analysis decodes the video once. On a single desktop CPU core, a 2-minute 1080p VP9 trailer took 5.6 s and a 60-second 640x360 H.264 video about 1.3 s. Apify cores can be somewhat slower; more memory gives more CPU cores.
- **Extra time:** keyframes add about 0.1 s per scene. Re-encoded clips run at roughly real time to a few times faster than real time, depending on resolution.
- **Limits:** `maxDurationMinutes` (default 180, max 600) and `maxFileSizeMB` (default 4,000).

**What is the difference between the clip modes?**

- **Stream copy** is lossless and very fast, but a video can only be cut on a keyframe. Each clip therefore starts at the keyframe at or before the scene start and can include a few frames, or seconds, of the previous shot. `clipStartSec` shows where it really starts.
- **Re-encode** gives frame-accurate H.264/AAC MP4 clips.
- **Auto** (default) copies when the scene starts exactly on a keyframe (encoders often place keyframes at cuts) and re-encodes otherwise. Every clip is frame-accurate and the fast path is used whenever possible.

**Can it process YouTube, TikTok or Vimeo links?**
No. The Actor needs a direct link to a video file, such as a URL ending in `.mp4`, or a cloud storage or CDN link. Web pages with an embedded player don't work. Only process videos you have the right to use.

**Is my video private?**
Yes. The video is downloaded into the Actor container and deleted after processing. Analysis runs locally with ffmpeg and the Actor's own detector, with no AI service or third-party API involved. Keyframes, exports and clips are stored only in your own Apify key-value store.

**Is it legal to analyze videos with this tool?**
Scene detection itself is legal. Make sure you own the videos or have permission to process them (or that they are public domain or openly licensed), especially before redistributing keyframes or clips. You are responsible for the content you submit.

**Which software and licenses does it use?**

- **ffmpeg:** the Debian build, run as a separate program (LGPL/GPL)
- **Apify SDK:** Apache-2.0
- **Detector:** the scene-detection algorithm is the Actor's own code
- No machine-learning models or datasets are bundled.

# Actor input Schema

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

Direct links to video files (MP4, MOV, MKV, WEBM, AVI, OGV, TS, ...). Each video becomes one result with its scene list, keyframes and exports. The link must return the file itself, not a web page with a player.

## `sensitivity` (type: `string`):

<b>Medium</b> suits most films, trailers, ads and vlogs. <b>High</b> also finds subtle cuts between similar-looking shots (may add a few false cuts on fast action). <b>Low</b> only keeps obvious changes.

## `minSceneLengthSec` (type: `number`):

Two scene changes closer than this are merged (the stronger one is kept). Raise it (e.g. 1-2 s) to ignore very short shots and strobe effects.

## `detectFades` (type: `boolean`):

Treat a fade-out to black (or white) followed by a new shot as a scene change. The new scene starts where the fade-in begins.

## `detectDissolves` (type: `boolean`):

Detect gradual transitions (cross-dissolves, wipes, slides) in addition to hard cuts.

## `keyframes` (type: `boolean`):

Save the sharpest representative frame of each scene to the key-value store and add <code>keyframeUrl</code> to every scene.

## `keyframeFormat` (type: `string`):

Image format of the keyframes.

## `keyframeWidth` (type: `integer`):

Keyframes are scaled down to this width (aspect ratio kept). 0 = original resolution.

## `maxKeyframes` (type: `integer`):

Keyframes are saved for the first N scenes only (the scene list itself is always complete).

## `exportCsv` (type: `boolean`):

Save a CSV with scene number, start/end frame, timecode, seconds, length and transition type (<code>csvUrl</code>).

## `exportEdl` (type: `boolean`):

Save a CMX3600 edit decision list that Premiere Pro, DaVinci Resolve, Final Cut (via conversion) and Avid can import (<code>edlUrl</code>).

## `splitClips` (type: `boolean`):

Cut the video into one file per scene and save the clips to the key-value store (<code>clipUrl</code> per scene). Uses extra storage.

## `splitMode` (type: `string`):

<b>Auto</b> (recommended): frame-accurate clips; uses lossless stream copy when the scene starts on a keyframe (common at real cuts) and re-encodes to H.264/AAC MP4 otherwise. <b>Stream copy</b>: fastest, original quality, but a clip can only start on a keyframe, so it may begin with up to a few seconds of the previous shot (<code>clipStartSec</code> shows where). <b>Re-encode</b>: every clip as frame-accurate H.264/AAC MP4.

## `maxClips` (type: `integer`):

Only the first N scenes are cut into clips.

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

Only the first N minutes of each video are analyzed (and billed). Longer videos are marked <code>truncated: true</code>.

## `analysisMaxFps` (type: `integer`):

Videos with a higher frame rate (e.g. 50/60 fps) are analyzed at this rate, which is about 2x faster with the same cut accuracy for normal footage. 0 = analyze every frame.

## `maxFileSizeMB` (type: `integer`):

Larger downloads are rejected (free error item). Use more memory/disk for very large files.

## Actor input object example

```json
{
  "videoUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv"
  ],
  "sensitivity": "medium",
  "minSceneLengthSec": 0.4,
  "detectFades": true,
  "detectDissolves": true,
  "keyframes": true,
  "keyframeFormat": "jpg",
  "keyframeWidth": 640,
  "maxKeyframes": 1000,
  "exportCsv": true,
  "exportEdl": true,
  "splitClips": false,
  "splitMode": "auto",
  "maxClips": 100,
  "maxDurationMinutes": 180,
  "analysisMaxFps": 30,
  "maxFileSizeMB": 4000
}
```

# Actor output Schema

## `scenes` (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": [
        "https://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("freecamp008/video-scene-detector").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://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv"] }

# Run the Actor and wait for it to finish
run = client.actor("freecamp008/video-scene-detector").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://upload.wikimedia.org/wikipedia/commons/b/b3/Big_Buck_Bunny_Trailer_400p.ogv"
  ]
}' |
apify call freecamp008/video-scene-detector --silent --output-dataset

```

## MCP server setup

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

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/sg0euhPh2XpIld4lM/builds/Ad2wWIjXX2oj0RYgY/openapi.json
