# FFmpeg Video Converter & Compressor — MP4, MP3, GIF, WhatsApp (`tidydata/ffmpeg-video-converter`) Actor

Convert and compress video and audio with FFmpeg: MP4, WebM, MOV, MP3, WAV, M4A, FLAC, GIF, thumbnails. Compress for WhatsApp, email, Discord or any size, 9:16 for Reels/TikTok, trim, mute, 16 kHz audio for Whisper. Links, uploads or datasets. For n8n, Make, Zapier.

- **URL**: https://apify.com/tidydata/ffmpeg-video-converter.md
- **Developed by:** [tidydata](https://apify.com/tidydata) (community)
- **Categories:** Videos, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $16.00 / 1,000 hd video minutes

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## 🎬 FFmpeg Video Converter & Compressor — MP4, MP3, GIF, WhatsApp

![Real runs: a 29 MB 1080p video compressed for WhatsApp to 4.2 MB and to 2.1 MB at 1080p, an uploaded WebM turned into 16 kHz audio for Whisper; 25 presets](https://api.apify.com/v2/key-value-stores/UJXqVadHhfb2eqS2e/records/ffmpeg-video-converter.png)

Convert and compress **video and audio** in the cloud with **FFmpeg** — no install, no server, no command line. Give it **links**, **upload files** or point it at **another Actor's dataset**, pick what you need, and get every result back as a **direct download link** with its size, duration, resolution and codecs.

- 📦 **Compress** for **WhatsApp (16 MB)**, **email (Gmail + Outlook)**, **Discord (10 MB)** or **any size you choose** — two-pass encoding, so the file really fits.
- 🔁 **Convert** to **MP4**, **WebM**, **MOV**, **MKV** — and **MOV → MP4 without quality loss** when the codecs already fit (lossless copy, seconds).
- 🎵 **Extract audio**: **MP3**, **M4A**, **WAV**, **FLAC**, **OGG**, **Opus**.
- 🤖 **Audio for AI transcription**: 16 kHz mono MP3 or WAV for **Whisper, OpenAI, Deepgram, AssemblyAI** (1.5 h of talk fits the 25 MB API limit).
- 📱 **Vertical 9:16** for Reels / TikTok / Shorts, **square 1:1**, **landscape 16:9** — with a blurred background, crop or black bars.
- ✂️ **Trim** (start / end), **change resolution** (4K → 1080p / 720p / 480p…), **lower the frame rate**, **remove audio**, **normalize loudness** (EBU R128).
- 🖼️ **GIF** with a high-quality palette, **thumbnails / frames as JPG** at any times.
- ℹ️ **Media info** of every input for free: duration, resolution, rotation, fps, codecs, bitrate, HDR, audio tracks.

**From $0.006 per minute of video and $0.002 per minute of audio.** Failed files are **free**, and nothing is ever charged above your spending limit.

### ✨ Why this one

| | |
|---|---|
| 💸 Price | **$0.02** per 720p minute, **$0.035** per 1080p minute, **$0.002** per audio minute — below the other FFmpeg Actors and far below FFmpeg SaaS plans |
| 📦 Size presets | WhatsApp, email, Discord or any MB — one click, really fits |
| 📱 Social formats | 9:16, 1:1, 16:9 with blurred background, crop or bars |
| 🤖 Speech-to-text ready | 16 kHz mono MP3/WAV with even loudness |
| 📥 Inputs | links, uploads, Drive / Dropbox / OneDrive, public Drive folders, HLS `.m3u8`, datasets of other Actors |
| ⚡ Lossless when possible | MOV/MKV → MP4 by copying the streams (seconds, no quality loss) |
| 🌈 iPhone HDR | HEVC 10-bit HDR tone-mapped to normal colors |
| 🧾 No subscription | pay per minute, failed files free, spending limit respected |

Made for **n8n Cloud, Make and Zapier**, which can't run FFmpeg themselves, and for **AI agents** (Apify MCP server).

### 🚀 How to use it

1. Paste one or more **links** (or **upload files**, or pick a **dataset** from a scraper).
2. Choose **What to do** (e.g. *Compress for WhatsApp*, *Extract audio → MP3*, *Vertical 9:16*).
3. Optional: start/end time to trim, resolution, quality, loudness.
4. Run. Each file gets a row with a `fileUrl` you can download, send or pass to the next step.

#### Input examples (API, n8n, Make, Zapier, AI agents)

Compress phone videos to send on WhatsApp:

```json
{
  "fileUrls": ["https://example.com/videos/holiday.mov"],
  "preset": "compress-whatsapp"
}
```

MP4 → MP3 for transcription with Whisper (the usual n8n Cloud problem):

```json
{
  "fileUrls": ["https://drive.google.com/file/d/FILE_ID/view"],
  "preset": "speech"
}
```

Fit a video into 25 MB, only the first 2 minutes:

```json
{
  "fileUrls": ["https://example.com/demo.mp4"],
  "preset": "compress-size",
  "targetSizeMb": 25,
  "endTime": "2:00"
}
```

Vertical clip for Reels/TikTok from a landscape video, 30 s from 1:10:

```json
{
  "fileUrls": ["https://example.com/talk.mp4"],
  "preset": "vertical",
  "fit": "blur",
  "startTime": "1:10",
  "endTime": "1:40"
}
```

GIF and thumbnails:

```json
{ "fileUrls": ["https://example.com/clip.mp4"], "preset": "gif", "startTime": "3", "gifMaxSeconds": 6, "gifWidth": 480 }
```

```json
{ "fileUrls": ["https://example.com/clip.mp4"], "preset": "thumbnail", "thumbnailTimes": "1, 25%, 50%, 75%" }
```

Every video file found by another Actor (chain it):

```json
{ "datasetId": "YOUR_DATASET_ID", "datasetUrlFields": "videoUrl", "preset": "mp4", "resolution": "720" }
```

**All presets:** `mp4`, `compress`, `compress-whatsapp`, `compress-email`, `compress-discord`, `compress-size`, `resize`, `vertical`, `square`, `landscape`, `mute`, `webm`, `mov`, `mkv`, `mp3`, `m4a`, `wav`, `flac`, `ogg`, `opus`, `speech`, `speech-wav`, `gif`, `thumbnail`, `info`.

#### n8n (Cloud or self-hosted)

1. Add the **Apify** node → *Run an Actor and get dataset* (or *HTTP Request* to the API below).
2. Actor: `tidydata/ffmpeg-video-converter`, input like the examples above (you can map `{{ $json.videoUrl }}` into `fileUrls`).
3. The output items have `fileUrl`: add an **HTTP Request** node with *Response format: File* to get the binary for the next node (OpenAI transcribe, Google Drive upload, Telegram, email…).

#### Make / Zapier

Use the **Apify** app → *Run an Actor* (wait for finish) → *Get dataset items*. Map `fileUrl` to the next module (Google Drive *Upload a file* from URL, WhatsApp, Gmail attachment, OpenAI…).

#### API (one call, waits for the result)

```bash
curl -X POST "https://api.apify.com/v2/acts/tidydata~ffmpeg-video-converter/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"fileUrls":["https://example.com/video.mov"],"preset":"mp4"}'
```

### 📤 Output

One row per input file (and a summary in the key-value store record `OUTPUT`):

```json
{
  "status": "ok",
  "preset": "compress-whatsapp",
  "fileName": "holiday-whatsapp.mp4",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/…/records/holiday-whatsapp.mp4?signature=…",
  "contentType": "video/mp4",
  "sizeMb": 15.03,
  "inputSizeMb": 179.57,
  "savedPercent": 91.6,
  "durationSec": 75.0,
  "width": 1280,
  "height": 720,
  "videoCodec": "h264",
  "audioCodec": "aac",
  "input": { "durationSec": 75.0, "width": 1920, "height": 1080, "videoCodec": "h264", "fps": 30, "hasAudio": true, "bitrateKbps": 20084 },
  "chargedEvents": { "hd-minute": 2 },
  "charged": true,
  "note": "Fitted under 15.5 MB at 720p (1576 kbps video)."
}
```

`fileUrl` is a **signed link**: it opens without an API token, so you can send it to anyone or to the next tool. A failed file has `status: "failed"`, a readable `error` (e.g. *"This file has no audio track, so there is no audio to extract."*) and costs nothing.

### 💰 Pricing (pay per event)

You pay per **started minute of the result** (a 2 min 10 s video = 3 minutes), by the resolution of the result (its short side, so vertical videos count the same as landscape):

| Event | Price | When |
|---|---|---|
| SD video minute | **$0.006** | result up to 480p |
| HD video minute | **$0.02** | result 720p |
| Full HD video minute | **$0.035** | result 1080p |
| 4K video minute | **$0.14** | result above 1080p |
| Audio minute | **$0.002** | MP3, M4A, WAV, FLAC, OGG, Opus, speech |
| GIF | **$0.01** | each GIF |
| Image | **$0.001** | each thumbnail |
| File info | **$0.001** | each file with the *Media info only* preset |

Examples: compress a 3-min phone video for WhatsApp (720p) = 3 × $0.02 = **$0.06**. MP4 → MP3 of a 1-hour podcast = **$0.12**. 100 thumbnails = **$0.10**. Failed files, files over your limits and skipped files are **free**. Apify Store discounts apply on paid plans.

Tip: trimming with *Start/End time* and *Resolution* lowers the price, because you pay for the result, not the input.

### ❓ FAQ

**Which links work?** Any public `http(s)` link to a video or audio file, Google Drive files and **public Drive folders**, Dropbox, OneDrive/SharePoint, archive.org, HLS `.m3u8` streams, and web pages that embed a video file. Files you **upload** in the input form work too.

**YouTube, TikTok, Instagram, Facebook, X, Vimeo?** Not supported, on purpose: their terms forbid downloading their content. Their CDNs are refused too.

**Which formats can it read?** Everything FFmpeg reads: MP4, MOV, MKV, WebM, AVI, WMV, FLV, MPEG-TS, 3GP, GIF; H.264, HEVC/H.265, AV1, VP8/VP9, ProRes, MPEG-2…; MP3, AAC, WAV, FLAC, OGG, Opus, WMA, AMR, AIFF.

**Are rotated and HDR phone videos handled?** Yes. Rotation is applied, and HDR (HEVC 10-bit) is tone-mapped to normal colors, so the result looks right on every screen.

**How big and how long can files be?** About 1.5 GB per file with the default 4 GB memory and 2 files at a time (3 GB with *Files at the same time* = 1; more memory = more disk), and up to 180 minutes per file by default (*Max minutes per file*, up to 600). More memory also gives more CPU, so big files convert faster.

**Will the compressed file really fit?** Yes: two-pass encoding aims just under the limit, and if the result is still over, it encodes once more with a lower bitrate. If a video is too long for the size (e.g. 2 hours into 10 MB), it fails **for free** and tells you the minimum size, so you can trim it.

**What if the video is already small?** The compressor never hands you a bigger file: if the input was already smaller than the result, you get the original back as MP4 (lossless).

**What happens when my spending limit is reached?** The Actor checks your limit **before** each file, so it never starts work it can't charge, and you are never charged above your *Max cost per run*. Files not converted get a `skipped` row.

**How long are the files kept?** In the run's key-value store, for your plan's data retention (7 days on the free plan). Copy them before that.

**Is it legal?** The Actor converts only the files you give it, without logging in or bypassing any paywall or DRM (protected streams are refused). Make sure you have the right to use those files.

### 🔗 Related Actors

- [Audio & Video Transcription](https://apify.com/tidydata/audio-video-transcription) — turn the audio into text with timestamps and subtitles
- [Video AI Analyzer](https://apify.com/tidydata/video-ai-analyzer) — what happens in a video: scenes, summary, hooks, answers to your question
- [Video Frame Extractor](https://apify.com/tidydata/video-frame-extractor) — frames at every scene change or every N seconds
- [Bulk File Downloader](https://apify.com/tidydata/bulk-file-downloader) — download any files in bulk, with clean names and a ZIP

⭐ If it saved you time, a review on the Store helps a lot. Questions or a missing format? Open an **Issue** — answered within a day.

# Actor input Schema

## `fileUrls` (type: `array`):

One link per line: direct links to MP4, MOV, MKV, WebM, AVI, MP3, WAV, M4A… files, Google Drive / Dropbox / OneDrive share links, public Google Drive folders, archive.org, HLS (.m3u8) streams, or a web page that embeds a video file. YouTube, TikTok, Instagram, Facebook, X, Vimeo and their CDNs are refused (their terms forbid downloading). Only convert files you have the right to use.

## `uploadedFiles` (type: `array`):

Upload video or audio files from your computer (they go to a key-value store of your account and only this run reads them).

## `keyValueStoreId` (type: `string`):

Convert the video/audio files saved in one of your key-value stores (e.g. the output of another Actor). Only read access to this one store is requested.

## `keyValueStoreKeys` (type: `array`):

Record keys to convert. Empty = every video or audio record of the store (up to 'Max files').

## `preset` (type: `string`):

One action for all the files of the run. Compress presets fit the file under the size limit automatically (two-pass encoding, resolution lowered only when needed).

## `targetSizeMb` (type: `integer`):

For 'Compress to a target size': the output file will be under this size (e.g. 8, 25, 50).

## `resolution` (type: `string`):

Caps the short side of the video (works for vertical videos too). Never upscales. Also sets the size of thumbnails and of vertical/square/landscape frames.

## `quality` (type: `string`):

For conversions without a size target (H.264 CRF 20 / 23 / 28).

## `fit` (type: `string`):

How a video that has another shape is placed into the vertical, square or landscape frame.

## `maxFps` (type: `integer`):

Lower the frame rate (e.g. 30 or 24) to make files smaller. 0 or empty = keep.

## `removeAudio` (type: `boolean`):

Same as the 'Remove audio' preset, but with any video preset (e.g. compress + mute).

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

Cut the file: start here. Seconds (90), mm:ss (1:30), hh:mm:ss, 1m30s or a percent (10%). Empty = from the start.

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

Cut the file: end here (same formats). Empty = to the end.

## `normalizeAudio` (type: `boolean`):

Even volume at -16 LUFS (EBU R128), good for podcasts, voice and social media. Always on for the AI transcription presets.

## `audioBitrateKbps` (type: `integer`):

Empty = good defaults (MP3 192, AAC 160, Opus 128, speech 32).

## `gifMaxSeconds` (type: `integer`):

GIFs are big: the first N seconds (after Start time) are used.

## `gifWidth` (type: `integer`):

Never upscaled.

## `gifFps` (type: `integer`):

Smoother GIFs need more frames per second, and get bigger.

## `gifColors` (type: `integer`):

Fewer colors = smaller GIF.

## `gifLoop` (type: `boolean`):

Off = plays once.

## `thumbnailTimes` (type: `string`):

Comma separated: seconds, mm:ss or percents, e.g. '1, 50%, 2:30' (max 20). Each image is one 'image' event.

## `datasetId` (type: `string`):

A dataset from another run whose rows contain video or audio links. Only read access to this one dataset is requested.

## `datasetUrlFields` (type: `string`):

Field name(s), comma separated; nested paths work (media.url, videos.0.src). Empty = detect it (videoUrl, mediaUrl, url, fileUrl…).

## `maxFiles` (type: `integer`):

Stop after this many files (links, folder files and dataset rows together).

## `maxFileSizeMb` (type: `integer`):

Bigger files are not downloaded (free). Lowered automatically to what the run's disk can hold (it grows with memory).

## `maxMinutesPerFile` (type: `integer`):

Longer files are refused before any work (free). Protects you from a costly surprise.

## `maxSecondsPerFile` (type: `integer`):

FFmpeg is stopped after this time (the file is free). More memory = more CPU = faster.

## `maxConcurrency` (type: `integer`):

Downloads overlap with conversion. Keep 2 unless you give the run a lot of memory.

## Actor input object example

```json
{
  "fileUrls": [
    "https://download.samplelib.com/mp4/sample-5s.mp4"
  ],
  "preset": "mp4",
  "resolution": "keep",
  "quality": "balanced",
  "fit": "blur",
  "removeAudio": false,
  "normalizeAudio": false,
  "gifMaxSeconds": 15,
  "gifWidth": 480,
  "gifFps": 12,
  "gifColors": 128,
  "gifLoop": true,
  "thumbnailTimes": "10%",
  "maxFiles": 100,
  "maxFileSizeMb": 2048,
  "maxMinutesPerFile": 180,
  "maxSecondsPerFile": 3000,
  "maxConcurrency": 2
}
```

# Actor output Schema

## `results` (type: `string`):

One row per input file: download link of the result, size before/after, duration, resolution, codecs, status and the reason when it failed.

## `files` (type: `string`):

Every converted file of the run.

# 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 = {
    "fileUrls": [
        "https://download.samplelib.com/mp4/sample-5s.mp4"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidydata/ffmpeg-video-converter").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 = { "fileUrls": ["https://download.samplelib.com/mp4/sample-5s.mp4"] }

# Run the Actor and wait for it to finish
run = client.actor("tidydata/ffmpeg-video-converter").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 '{
  "fileUrls": [
    "https://download.samplelib.com/mp4/sample-5s.mp4"
  ]
}' |
apify call tidydata/ffmpeg-video-converter --silent --output-dataset

```

## MCP server setup

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

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/xb1qnGBYIbZRtXsTP/builds/Z3pDzQsoxygqUs0dc/openapi.json
