# Video Thumbnail Extractor (`happitap/video-thumbnail-extractor`) Actor

Extract high-quality thumbnails from videos across multiple platforms including YouTube, Vimeo, direct video URLs, and more.

- **URL**: https://apify.com/happitap/video-thumbnail-extractor.md
- **Developed by:** [HappiTap](https://apify.com/happitap) (community)
- **Categories:** Videos, Developer tools, Automation
- **Stats:** 154 total users, 16 monthly users, 100.0% runs succeeded, 10 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.01 / 1,000 results

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 Thumbnail Extractor - Multi-Platform Support

Extract high-quality thumbnails from videos across multiple platforms including YouTube, Vimeo, direct video URLs, and more.

### 🌟 Features

#### Multi-Platform Video Support

- **YouTube** - Extract thumbnails from any YouTube video
- **Vimeo** - Process Vimeo videos
- **Dailymotion** - Support for Dailymotion videos
- **Direct Video URLs** - MP4, AVI, MOV, MKV, WebM, FLV, WMV, M4V files
- **Generic URLs** - Automatic detection and processing via yt-dlp

#### Thumbnail Extraction Features

- ✅ **Multiple Extraction Methods** - Evenly spaced, custom timestamps, key frames, or beginning/middle/end
- ✅ **Customizable Count** - Extract 1-20 thumbnails per video
- ✅ **High Quality** - Configurable resolution and image quality
- ✅ **Multiple Formats** - Output as JPEG, PNG, or WebP
- ✅ **Batch Processing** - Process multiple videos simultaneously
- ✅ **Automatic Upload** - Store thumbnails in Apify Key-Value Store
- ✅ **Base64 Encoding** - Optional base64 encoded output
- ✅ **Video Metadata** - Extract title, duration, and other info

### 💰 Pricing - Pay Per Thumbnail

This actor uses **tiered pay-per-event pricing** based on extraction complexity:

| Platform Type | Price per Thumbnail | Best For |
|---------------|---------------------|----------|
| **YouTube** (Native) | **$0.001** (0.1¢) | YouTube videos - instant extraction |
| **Direct URLs** | **$0.005** (0.5¢) | MP4, AVI, MOV files - frame streaming |
| **Streaming Platforms** | **$0.01** (1¢) | Vimeo, Dailymotion - requires download |

#### Why Tiered Pricing?

- **YouTube Native:** Uses YouTube's built-in thumbnails - minimal resources, minimal cost ⚡
- **Direct URLs:** Streams video frames directly - moderate resources, fair pricing 🎬
- **Streaming Platforms:** Requires full video download - maximum resources, premium pricing 📺

#### Example Costs

- **100 YouTube thumbnails:** $0.10
- **100 Direct URL thumbnails:** $0.50
- **100 Vimeo thumbnails:** $1.00

**See [PRICING.md](./PRICING.md) for detailed pricing information and examples.**

### 📋 Input Parameters

#### Required

- `videoUrls` - Array of video URLs to process

#### Optional

- `thumbnailCount` - Number of thumbnails per video (default: 3, range: 1-20)
- `extractionMethod` - How to select frames:
  - `evenly-spaced` - Distribute thumbnails evenly across video (default)
  - `custom-timestamps` - Extract at specific timestamps
  - `key-frames` - Extract at key frames
  - `beginning-middle-end` - Extract from start, middle, and end
- `customTimestamps` - Array of timestamps in seconds (for custom-timestamps method)
- `thumbnailWidth` - Width in pixels (default: 1280, range: 320-3840)
- `outputFormat` - Image format: `jpg`, `png`, or `webp` (default: jpg)
- `imageQuality` - Quality 1-100 (default: 85)
- `uploadToKeyValueStore` - Store images in Key-Value Store (default: true)
- `returnBase64` - Include base64 encoded images in output (default: false)

### 📝 Example Usage

#### Basic Example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "thumbnailCount": 3,
  "extractionMethod": "evenly-spaced",
  "outputFormat": "jpg"
}
```

#### Advanced Example - Custom Timestamps

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=example",
    "https://vimeo.com/123456789",
    "https://example.com/video.mp4"
  ],
  "thumbnailCount": 5,
  "extractionMethod": "custom-timestamps",
  "customTimestamps": [10, 30, 60, 120, 180],
  "thumbnailWidth": 1920,
  "outputFormat": "png",
  "imageQuality": 95,
  "uploadToKeyValueStore": true,
  "returnBase64": false
}
```

#### High Quality Thumbnails

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=example"],
  "thumbnailCount": 10,
  "extractionMethod": "evenly-spaced",
  "thumbnailWidth": 3840,
  "outputFormat": "png",
  "imageQuality": 100
}
```

### 📤 Output Format

#### Dataset Output

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=example",
  "platform": "youtube",
  "success": true,
  "processedAt": "2025-11-17T16:00:00.000Z",
  "thumbnailCount": 3,
  "thumbnails": [
    {
      "index": 0,
      "timestamp": 45.5,
      "timestampFormatted": "0:45",
      "keyValueStoreKey": "video_thumb_0.jpg"
    }
  ],
  "videoInfo": {
    "title": "Example Video",
    "duration": 180,
    "uploader": "Channel Name"
  }
}
```

#### Key-Value Store

Thumbnails are automatically uploaded to the Key-Value Store with keys like:

- `video_thumb_0.jpg`
- `video_thumb_1.jpg`
- etc.

Access them via:

```
https://api.apify.com/v2/key-value-stores/[STORE_ID]/records/[KEY]
```

### 🎯 Use Cases

#### Content Creation

- Generate video previews for websites
- Create thumbnail galleries
- Extract key moments from videos

#### Video Analysis

- Sample frames for quality checking
- Extract frames for machine learning training
- Create video summaries

#### Marketing

- Generate social media preview images
- Create video thumbnails for email campaigns
- Extract product shots from demo videos

### 🔧 Technical Details

#### Supported Video Platforms

- YouTube (all formats)
- Vimeo
- Dailymotion
- Direct video file URLs
- Any platform supported by yt-dlp (800+ sites)

#### Supported Video Formats

- MP4, AVI, MOV, MKV, WebM, FLV, WMV, M4V
- And many more via ffmpeg

#### Image Processing

- Powered by **ffmpeg** for frame extraction
- **Sharp** for image optimization and format conversion
- Maintains aspect ratio automatically
- High-quality output with configurable settings

### ⚙️ Configuration Tips

#### For Best Quality

```json
{
  "thumbnailWidth": 1920,
  "outputFormat": "png",
  "imageQuality": 95
}
```

#### For Smaller File Sizes

```json
{
  "thumbnailWidth": 1280,
  "outputFormat": "webp",
  "imageQuality": 75
}
```

#### For Specific Moments

```json
{
  "extractionMethod": "custom-timestamps",
  "customTimestamps": [5, 30, 60, 120]
}
```

### 🚀 Performance

- Processes videos efficiently using ffmpeg
- Automatic cleanup of temporary files
- Optimized for batch processing
- Handles large videos (up to 500MB)

### 📊 Pricing

This actor uses standard Apify platform pricing based on:

- Compute units consumed
- Storage for Key-Value Store items

Typical usage:

- \~0.01 compute units per thumbnail extracted
- Storage costs for uploaded thumbnails

### 🔍 Troubleshooting

#### Video Download Fails

- Ensure the URL is publicly accessible
- Check if the platform is supported by yt-dlp
- Verify the video is not geo-restricted

#### Poor Quality Thumbnails

- Increase `thumbnailWidth` parameter
- Use PNG format for better quality
- Increase `imageQuality` setting

#### Timeout Issues

- Reduce `thumbnailCount` for long videos
- Use lower resolution settings
- Process videos in smaller batches

### 📚 Related Actors

- **PDF OCR API** - Extract text from PDF documents
- **Image Processing API** - Advanced image manipulation
- **Video Metadata Extractor** - Get detailed video information

### 📄 License

Apache-2.0

### 🤝 Support

For issues, questions, or feature requests, please contact HappiTap team.

***

**Built with ❤️ using Apify, ffmpeg, yt-dlp, and Sharp**

# Actor input Schema

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

Array of video URLs to process (YouTube, direct video files, Vimeo, etc.)

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

Number of thumbnails to extract per video

## `extractionMethod` (type: `string`):

How to select frames for thumbnails

## `customTimestamps` (type: `string`):

Comma-separated timestamps in seconds (only used if extraction method is 'custom-timestamps'). Example: 10,30,60,120

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

Width of output thumbnails (height will be auto-calculated to maintain aspect ratio)

## `outputFormat` (type: `string`):

Format for thumbnail images

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

Quality of output images (1-100, higher is better)

## `uploadToKeyValueStore` (type: `boolean`):

Store thumbnail images in Apify Key-Value Store

## `returnBase64` (type: `boolean`):

Include base64 encoded images in the output

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "thumbnailCount": 3,
  "extractionMethod": "evenly-spaced",
  "customTimestamps": "",
  "thumbnailWidth": 1280,
  "outputFormat": "jpg",
  "imageQuality": 85,
  "uploadToKeyValueStore": true,
  "returnBase64": false
}
```

# Actor output Schema

## `overview` (type: `string`):

Quick overview of processed videos with platform and thumbnail counts

## `allVideos` (type: `string`):

Complete dataset with all video processing results and thumbnail metadata

## `thumbnailFiles` (type: `string`):

All extracted thumbnail image files stored in the key-value store

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

Summary of the extraction run with success/failure counts and total thumbnails

# 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://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("happitap/video-thumbnail-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://www.youtube.com/watch?v=dQw4w9WgXcQ"] }

# Run the Actor and wait for it to finish
run = client.actor("happitap/video-thumbnail-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://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}' |
apify call happitap/video-thumbnail-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,happitap/video-thumbnail-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/SOCnERYqYgKDJVGL7/builds/30PdfSKJTQ6yZka1h/openapi.json
