# Video Thumbnail Generator - Contact Sheets & GIF Previews (`freecamp008/video-thumbnail-generator`) Actor

Create video contact sheets with timestamps, pick the best thumbnails automatically (sharp, well-exposed, no black frames) and make animated GIF/WebP preview clips from any video URL. Runs ffmpeg inside the Actor, no external APIs.

- **URL**: https://apify.com/freecamp008/video-thumbnail-generator.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 $4.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 Thumbnail Generator: Contact Sheets, Smart Thumbnails, GIF & WebP Previews

Turn any video URL into **contact sheets**, **automatically chosen best thumbnails** and **animated GIF / WebP preview clips**. The Actor scores frames across the whole video for sharpness, exposure, contrast, detail and color, skips black and blank frames, and saves the best, visually different frames as JPEG, PNG or WebP. Everything runs with ffmpeg inside the Actor. No external APIs, no uploads to third-party services.

### What does Video Thumbnail Generator do?

- Downloads each video from its URL and reads it with ffmpeg (MP4, MOV, MKV, WEBM, AVI, OGV, M4V, TS and most other formats)
- **Contact sheet**: one image with a grid of evenly spaced frames (default 4 x 4), a timestamp on every tile and a header with file name, duration, resolution, frame rate, codecs and file size
- **Smart thumbnails**: analyzes up to 240 frames per video and ranks them by sharpness, exposure, contrast, detail (entropy) and colorfulness, then picks the best frames that show *different* scenes
- **Animated previews**: a short looping GIF and/or animated WebP, either as a *highlights montage* of the best moments or as a *single clip* from a start time you choose
- Saves every file to the run's key-value store and returns public URLs plus the quality metrics of each thumbnail

### Key features

- **No black frames, no blurry frames**: fades, cuts to black, blank title cards, motion blur and dissolves get low scores
- **Diverse picks**: thumbnails are spread over the video and checked for visual difference (color histogram and image layout), so you don't get three near-identical shots
- **Works on real-world video**: H.264, H.265/HEVC, VP8, VP9, AV1, Theora, ProRes, MPEG-2 and more; rotated phone videos and anamorphic pixels are displayed the right way
- **Contact sheets for any length**: from a 10-second clip to a 3-hour movie (long videos are sampled by keyframes, so they stay fast)
- **Small previews**: GIFs use an optimized palette; if a GIF gets too big (film grain, noise) it is automatically re-encoded smaller to fit your size limit. Animated WebP is usually 5-10x smaller than GIF.
- **Full control**: grid size, sheet width, number and width of thumbnails, JPEG/PNG/WebP, quality, preview length, frame rate and width
- **HTTP API (Standby mode)**: call the Actor like a REST endpoint and get the URLs back in the response

### Use cases

- **Video platforms and CMSs**: generate poster images and hover previews when users upload videos
- **Media asset management**: visual summaries (contact sheets) for video libraries, stock footage and archives
- **Video SEO**: pick an attractive thumbnail for YouTube, Vimeo, social posts and `og:image` tags
- **Content moderation and review**: see the whole video at a glance without watching it
- **E-commerce and real estate**: animated previews for product and property videos
- **AI pipelines**: send a contact sheet or the top frames to a vision model instead of the full video

### How to use Video Thumbnail Generator

#### In Apify Console

1. Click **Try for free** or **Start**.
2. Paste one or more **direct links to video files** into *Video URLs*.
3. Choose what you want: *Contact sheet*, *Smart thumbnails*, *Animated GIF preview*, *Animated WebP preview* (all are on by default).
4. Click **Start**. The results table shows the best thumbnail, the contact sheet and the GIF for each video. All files are listed under **Image and animation files**.

#### Via the Apify API

```bash
curl -X POST "https://api.apify.com/v2/acts/freecamp008~video-thumbnail-generator/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "videoUrls": ["https://upload.wikimedia.org/wikipedia/commons/3/32/Chandra_-_Short_Film_Trailer.webm"],
    "sheetColumns": 5,
    "sheetRows": 4,
    "thumbnailCount": 3,
    "gifPreview": true
  }'
```

You can also use the [apify-client](https://docs.apify.com/api/client/js/) for JavaScript or Python and read the results from the run's default dataset.

#### Standby mode (instant HTTP endpoint)

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

```bash
## GET: only smart thumbnails
curl "https://freecamp008--video-thumbnail-generator.apify.actor/?token=YOUR_API_TOKEN&videoUrls=https://upload.wikimedia.org/wikipedia/commons/3/32/Chandra_-_Short_Film_Trailer.webm&contactSheet=false&gifPreview=false&webpPreview=false&thumbnailCount=1"

## POST: a 4-second WebP clip starting at 0:20
curl -X POST "https://freecamp008--video-thumbnail-generator.apify.actor/?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls": ["https://example.com/video.mp4"], "contactSheet": false, "smartThumbnails": false, "gifPreview": false, "previewMode": "clip", "previewStartSec": 20, "previewDurationSec": 4}'
```

**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/3/32/Chandra_-_Short_Film_Trailer.webm"],
  "contactSheet": true,
  "sheetColumns": 4,
  "sheetRows": 4,
  "sheetWidth": 1600,
  "smartThumbnails": true,
  "thumbnailCount": 3,
  "thumbnailWidth": 1280,
  "imageFormat": "jpeg",
  "gifPreview": true,
  "webpPreview": true,
  "previewMode": "montage",
  "previewDurationSec": 6,
  "previewSnippets": 4,
  "previewWidth": 480,
  "previewFps": 10
}
```

| Field | Description | Default |
|---|---|---|
| `videoUrls` | Direct links to video files | required |
| `contactSheet`, `sheetColumns`, `sheetRows`, `sheetWidth` | Contact sheet on/off, grid and width in px | `true`, 4, 4, 1600 |
| `sheetTimestamps`, `sheetHeader`, `sheetSkipBlack` | Timestamps on tiles, info header, avoid black frames | `true` |
| `smartThumbnails`, `thumbnailCount`, `thumbnailWidth` | Best-frame thumbnails, how many, width (0 = original) | `true`, 3, 1280 |
| `imageFormat`, `imageQuality` | `jpeg`, `png` or `webp`; quality 30-100 | `jpeg`, 85 |
| `gifPreview`, `webpPreview` | Animated previews | `true` |
| `previewMode` | `montage` (best moments) or `clip` (one continuous clip) | `montage` |
| `previewDurationSec`, `previewSnippets`, `previewStartSec` | Length, montage snippets, clip start | 6, 4, auto |
| `previewWidth`, `previewFps`, `maxGifSizeMB` | Preview size, frame rate, GIF size limit | 480, 10, 5 |
| `maxDurationMinutes`, `maxFileSizeMB` | Analyze/bill at most N minutes; skip bigger files | 180, 2048 |

### Output example

One dataset item per video (URLs shortened):

```json
{
  "videoUrl": "https://upload.wikimedia.org/wikipedia/commons/3/32/Chandra_-_Short_Film_Trailer.webm",
  "fileName": "Chandra_-_Short_Film_Trailer.webm",
  "durationSec": 60.02,
  "analyzedSec": 60.02,
  "width": 1280,
  "height": 536,
  "fps": 24,
  "videoCodec": "vp9",
  "fileSizeMB": 7.52,
  "scanMethod": "decode",
  "framesAnalyzed": 240,
  "bestThumbnailUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v8dd45aaa6b395c-thumb-1",
  "thumbnails": [
    { "rank": 1, "timeSec": 19.31, "timecode": "00:00:19.306", "url": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v8dd45aaa6b395c-thumb-1", "width": 1280, "height": 536, "sizeKB": 58, "score": 0.889, "sharpness": 0.91, "exposure": 0.98, "entropy": 7.64, "brightness": 113, "contrast": 72, "colorfulness": 16 },
    { "rank": 2, "timeSec": 50.1, "timecode": "00:00:50.097", "url": "https://api.apify.com/.../v8dd45aaa6b395c-thumb-2", "score": 0.821 },
    { "rank": 3, "timeSec": 3.76, "timecode": "00:00:03.764", "url": "https://api.apify.com/.../v8dd45aaa6b395c-thumb-3", "score": 0.774 }
  ],
  "contactSheetUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v8dd45aaa6b395c-sheet",
  "contactSheet": { "width": 1596, "height": 778, "columns": 4, "rows": 4, "sizeKB": 149, "frameTimesSec": [1.88, 5.63, 10.69, 13.13] },
  "gifUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v8dd45aaa6b395c-preview-gif",
  "webpUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/v8dd45aaa6b395c-preview-webp",
  "preview": { "mode": "montage", "width": 480, "height": 202, "fps": 10, "frames": 60, "durationSec": 6, "segmentsSec": [[3.01, 4.51], [18.56, 20.06], [27.9, 29.4], [49.35, 50.85]], "gifSizeKB": 1890, "webpSizeKB": 423 },
  "billedMinutes": 1,
  "truncated": false,
  "truncatedReason": null,
  "processingSec": 9.7,
  "timings": { "downloadSec": 1.2, "thumbnailsSec": 1.9, "contactSheetSec": 1.1, "previewSec": 2.4 }
}
```

`score` is 0-1 (higher is better). `sharpness` is relative to the other frames of the same video, `exposure` is 1 for a well-balanced image, `entropy` is the amount of detail in bits (max 8). When a video can't be downloaded or read, the Actor returns `{ "videoUrl", "error", "isError": true }` for it, and that item is free.

### Pricing

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

| Event | Price | Per 1,000 |
|---|---|---|
| `video-processed`: one video turned into thumbnails / contact sheet / previews | $0.004 | **$4 per 1,000 videos** |
| `video-minute`: one started minute of video analyzed (rounded up per video) | $0.0005 | **$0.50 per 1,000 minutes** |

Examples: a 1-minute clip costs $0.004 + $0.0005 = **$0.0045**. A 90-minute movie costs $0.004 + 90 x $0.0005 = **$0.049**. 1,000 short social videos (under 1 minute each) cost **$4.50**.

Failed downloads and unreadable files are free. Apify platform usage (compute units) is billed separately, according to the memory you choose and how long the run takes.

### FAQ

**How does it pick the "best" thumbnail?**
It decodes up to 240 frames spread over the video (keyframes for videos over 10 minutes) and scores each one: sharpness (variance of the Laplacian, ranked within the video), exposure (not too dark, not blown out), contrast, detail (histogram entropy) and colorfulness. Black, blank and nearly uniform frames are rejected, and the first and last 4% of the video (logos, credits) get a small penalty. The top frames must differ in time and look, so each thumbnail shows a different scene. It does not detect faces or understand what's in the picture.

**What are the limits?**
Files up to 2 GB by default (`maxFileSizeMB`, up to 8 GB; the file is downloaded to the Actor's disk, so use more memory for very large files). Only the first `maxDurationMinutes` (default 180) are analyzed. Previews are up to 15 s, 720 px wide and 24 fps. A 1080p, 1-minute video takes about 10-20 seconds on 2 GB of memory; 4K and long videos take longer.

**Why is my GIF smaller or choppier than I asked for?**
GIF has only 256 colors and compresses film grain and noise badly. If the GIF is bigger than `maxGifSizeMB` (default 5 MB), the Actor re-encodes it with fewer colors, a lower frame rate and a smaller size, and reports the settings in `preview.gifReduced`. Use the WebP preview for full color at a fraction of the size.

**Can it use YouTube, TikTok or Instagram links?**
No. It needs a direct link to the video file (a URL that downloads the MP4/WEBM/MOV itself). Web pages with an embedded player don't work. Only process videos you have the right to use.

**Does it support HDR, rotated and vertical videos?**
Rotated phone videos (rotation metadata) and non-square pixels are displayed correctly, and vertical 9:16 videos work. HDR (PQ/HLG) videos are not tone-mapped, so their thumbnails look flat and washed out.

**Is my video private?**
Yes. The video is downloaded into the Actor container, processed with ffmpeg and deleted after processing. Nothing is sent to a third-party API. The images and animations are stored only in your own Apify key-value store (the URLs are unguessable, but anyone with the link can open them).

**Is it legal to make thumbnails of videos?**
Creating thumbnails and previews of videos you own, have a license for, or that are public domain or openly licensed is legal. For other people's videos, respect copyright and the platform's terms. You are responsible for the videos you submit and how you use the results.

**Which libraries does it use?**
ffmpeg (LGPL/GPL build from Debian, run as a separate program) and sharp/libvips (Apache-2.0 / LGPL) for image composition and WebP encoding. The DejaVu fonts (free license) are used for the contact sheet text.

# Actor input Schema

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

Direct links to video files (MP4, MOV, MKV, WEBM, AVI, OGV, M4V, TS, ...). Each video becomes one result with its contact sheet, thumbnails and preview animations. The link must return the video file itself, not a web page with a player.

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

Create one image with a grid of evenly spaced frames, timestamps and a header with file name, duration, resolution and codec.

## `sheetColumns` (type: `integer`):

Number of frames per row on the contact sheet.

## `sheetRows` (type: `integer`):

Number of rows on the contact sheet. Columns x rows frames are taken at equal intervals.

## `sheetWidth` (type: `integer`):

Width of the contact sheet image in pixels. The height follows from the video's aspect ratio and the number of rows.

## `sheetTimestamps` (type: `boolean`):

Print the time of each frame (m:ss or h:mm:ss) in the corner of the tile.

## `sheetHeader` (type: `boolean`):

Add a header with the file name, duration, resolution, frame rate, codecs and file size.

## `sheetSkipBlack` (type: `boolean`):

If a sampled frame is black or blank (fade, cut to black), take a frame slightly later instead.

## `smartThumbnails` (type: `boolean`):

Score frames across the whole video for sharpness, exposure, contrast, detail (entropy) and color, skip black and blank frames, and save the best, visually different ones as images.

## `thumbnailCount` (type: `integer`):

How many of the best frames to save per video. They are chosen to show different scenes.

## `thumbnailWidth` (type: `integer`):

Width of each thumbnail in pixels (height keeps the aspect ratio). 0 = original video resolution. Videos are never upscaled.

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

File format for thumbnails and the contact sheet.

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

JPEG / WebP quality (30-100). Ignored for PNG.

## `gifPreview` (type: `boolean`):

Create a short looping animated GIF preview of the video.

## `webpPreview` (type: `boolean`):

Create the same preview as an animated WebP (much smaller than GIF, full color).

## `previewMode` (type: `string`):

<b>Highlights montage</b>: short snippets from the best-looking, different moments of the video, in order. <b>Single clip</b>: one continuous clip that starts at <i>Clip start</i> (or around the best frame if empty).

## `previewDurationSec` (type: `integer`):

Total length of the animated preview in seconds.

## `previewSnippets` (type: `integer`):

Number of snippets in a highlights montage (each one is preview length / snippets long).

## `previewStartSec` (type: `number`):

Single clip mode only: start time of the clip in seconds. Leave empty to center the clip on the best frame.

## `previewWidth` (type: `integer`):

Width of the animated preview in pixels (height keeps the aspect ratio).

## `previewFps` (type: `integer`):

Frames per second of the animated preview. 10-12 fps keeps GIFs small; 24 fps is smoother.

## `maxGifSizeMB` (type: `integer`):

If the GIF comes out larger (grainy or noisy footage), it is re-encoded with fewer colors, a lower frame rate and a smaller size until it fits. WebP previews are usually 5-10x smaller.

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

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

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

Videos larger than this are skipped (free). The file is downloaded to the Actor's disk before processing.

## Actor input object example

```json
{
  "videoUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/3/32/Chandra_-_Short_Film_Trailer.webm"
  ],
  "contactSheet": true,
  "sheetColumns": 4,
  "sheetRows": 4,
  "sheetWidth": 1600,
  "sheetTimestamps": true,
  "sheetHeader": true,
  "sheetSkipBlack": true,
  "smartThumbnails": true,
  "thumbnailCount": 3,
  "thumbnailWidth": 1280,
  "imageFormat": "jpeg",
  "imageQuality": 85,
  "gifPreview": true,
  "webpPreview": true,
  "previewMode": "montage",
  "previewDurationSec": 6,
  "previewSnippets": 4,
  "previewWidth": 480,
  "previewFps": 10,
  "maxGifSizeMB": 5,
  "maxDurationMinutes": 180,
  "maxFileSizeMB": 2048
}
```

# Actor output Schema

## `results` (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/3/32/Chandra_-_Short_Film_Trailer.webm"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("freecamp008/video-thumbnail-generator").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/3/32/Chandra_-_Short_Film_Trailer.webm"] }

# Run the Actor and wait for it to finish
run = client.actor("freecamp008/video-thumbnail-generator").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/3/32/Chandra_-_Short_Film_Trailer.webm"
  ]
}' |
apify call freecamp008/video-thumbnail-generator --silent --output-dataset

```

## MCP server setup

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

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/SVfDt7aHUxYwV5wRO/builds/FIF0k4ouYe4cbZRCa/openapi.json
