# Video & Audio Converter: Compress MP4, MP3, WebM, GIF (FFmpeg) (`greenrun/video-converter`) Actor

Convert and compress your video and audio files with FFmpeg: MP4 or WebM at 240p to 1080p, target file size, MP4 to MP3, M4A, WAV, FLAC, OGG or Opus, trim, mute, GIF. Direct file links only, no YouTube or social media pages. Failed and blocked files are free.

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

## Pricing

from $30.00 / 1,000 video minute, up to 480ps

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 & Audio Converter: Compress MP4, MP3, WebM, GIF (FFmpeg)

Convert and compress your video and audio files with FFmpeg: MP4 or WebM at 240p to 1080p, a target file size, MP4 to MP3, M4A, WAV, FLAC, OGG or Opus, trim, mute, GIF. Direct file links only, no YouTube or social media pages.

Give the Actor links to video or audio files, a dataset field with links (for example the output of another Actor) or records of a key-value store, and choose the output. **You get one dataset row per file with a download link to the converted file, its size, length and resolution. You pay per started minute of output, by its resolution; links that fail, blocked files and files that are not media are free.**

### What it does

- **Reads** video and audio files from direct links, a dataset field or a key-value store: MP4, MOV, WebM, MKV, AVI, MPEG-TS, 3GP, MP3, M4A, WAV, FLAC, OGG and other formats FFmpeg reads, with H.264, HEVC (iPhone), VP9, AV1, ProRes and more.
- **Converts** video to MP4 (H.264 + AAC, plays everywhere), MOV or WebM (VP9 + Opus) at 1080p, 720p, 480p, 360p or 240p, never upscaled, with three quality levels.
- **Compresses** to a target file size (for e-mail, Discord, WhatsApp): the bitrate follows from the length, and the resolution steps down when the size is too small for it.
- **Extracts** the sound as MP3, M4A, WAV, FLAC, OGG or Opus, or makes an animated GIF with an optimised palette.
- **Trims** to a start and end time, removes the sound, lowers the frame rate, removes metadata (GPS location of phone videos).
- **Fixes** what makes converted phone videos look wrong: rotation, odd sizes, HDR (tone-mapped to normal colours), interlacing.
- **Explains** every free result: not found, blocked by robots.txt, a web page instead of a file, an audio file for a video output, a video platform page.

### Why use it

- **Per minute of output, by resolution.** $0.03 a minute up to 480p, $0.045 at 720p, $0.08 at 1080p, $0.002 a minute of audio, $0.01 a GIF. No fee per file.
- **Pay only for results.** Inputs that are not found, blocked by the site or are not media are saved for free with the reason. Only the trimmed part is charged.
- **Predictable.** Each row shows the events it was charged, and the `RUN-REPORT` record the run's totals.
- **Respectful.** robots.txt is always respected. No proxies, no CAPTCHA solving, no login, no downloads from video platforms.
- **Built for AI agents.** Clear status messages, a fixed price per output minute, and limited permissions.

### How to use

#### In Apify Console

1. Paste links to video or audio files into **Video or audio file URLs**, one per line (or pick a dataset or a key-value store).
2. Choose the **Output format** and, for video, the **Resolution** and **Quality** (or a **Target file size**).
3. Optional: **Start time** and **End time** to convert only a part, **Remove audio**, the GIF settings.
4. Press **Start**. The **Output** tab shows one row per file with the link to the converted file; the files are in the run's key-value store.

#### From an AI agent (MCP)

Connect any MCP client to the Apify MCP server with only this Actor as a tool:

```
https://mcp.apify.com?tools=greenrun/video-converter
```

#### Through the API

```bash
curl -X POST "https://api.apify.com/v2/acts/greenrun~video-converter/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"mediaUrls": ["https://upload.wikimedia.org/wikipedia/commons/e/e3/Koel_at_bird_bath.webm"], "outputFormat": "mp4", "resolution": "720"}'
```

### Input

| Field | Default | Description |
|---|---|---|
| `mediaUrls` | example links | Direct http or https links to video or audio files, one per line. Pages of YouTube, TikTok, Instagram and other platforms are returned free with the reason. |
| `outputFormat` | `mp4` | `mp4`, `webm`, `mov`, `mp3`, `m4a`, `wav`, `flac`, `ogg`, `opus` or `gif`. |
| `resolution` | `720` | Short side of a video output: `original` (at most 1080p), `1080`, `720`, `480`, `360`, `240`. Never upscaled. |
| `quality` | `balanced` | `high`, `balanced` or `small` (H.264 CRF 20, 23, 28; VP9 CRF 30, 34, 40) and the default audio bitrate. |
| `targetSizeMb` | empty | Make the result at most this size; the resolution steps down when needed. Lossy audio too; ignored for WAV, FLAC and GIF. |
| `startTime`, `endTime` | empty | Convert only this part: seconds (75.5) or HH:MM:SS.mmm. |
| `mute` | false | Video without the sound track. |
| `maxFps` | 0 | Highest frame rate; 0 keeps the file's (at most 60). |
| `audioBitrateKbps` | 0 | Audio bitrate; 0 follows the quality (MP3 256, 192, 128 kbps; AAC 160, 128, 96; Opus 128, 96, 64). |
| `gifFps`, `gifWidth`, `gifMaxSeconds` | 12, 480, 15 | Frame rate, width and longest length of a GIF. |
| `datasetId` | empty | Also take the file links found in this dataset, for example the output of another Actor. |
| `datasetField` | `url` | Field of each dataset item that holds the link; dot paths and lists work (`media.video`, `files.url`). |
| `keyValueStoreId` | empty | Convert files stored as records of this key-value store. Choosing the store gives the Actor read access. |
| `keyValueStoreKeys` | empty | Keys of the records; empty takes every record whose key ends with a video or audio extension. |
| `maxFileSizeMb` | 4000 | Larger files are skipped for free. A run gets twice its memory as disk, for the file and its result. |
| `maxConcurrency` | 2 | Files downloaded at the same time. |
| `timeoutSecs` | 3600 | Longest time for one file; the part converted until then is kept. |

### Output

One row per file. A real row from a run on 21.11.2026 (a WebM clip from Wikimedia Commons to the default MP4 720p; the clip is 480p, so it stays 480p and is charged as one 480p minute):

```json
{
  "index": 2,
  "input": "https://upload.wikimedia.org/wikipedia/commons/5/5b/A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay%2C_Venezuela.webm",
  "status": "converted",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/ITclPN6448pfDL3qs/records/f0002-A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay.mp4?signature=...",
  "fileKey": "f0002-A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay.mp4",
  "outputFormat": "mp4",
  "mimeType": "video/mp4",
  "outputSizeBytes": 991624,
  "outputDurationSecs": 15.015,
  "outputWidth": 640,
  "outputHeight": 480,
  "outputFps": 29.97,
  "tier": "video-minute-sd",
  "complete": true,
  "inputFileName": "A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay,_Venezuela.webm",
  "inputSizeBytes": 1105281,
  "inputDurationSecs": 15.015,
  "inputWidth": 640,
  "inputHeight": 480,
  "inputCodec": "vp9",
  "inputAudioCodec": "opus",
  "compressionRatio": 1.11,
  "processingSecs": 1.25,
  "error": null,
  "billableEvents": {"video-minute-sd": 1, "video-minute-hd": 0, "video-minute-fullhd": 0, "input-4k-minute": 0, "audio-minute": 0, "gif": 0}
}
```

The `RUN-REPORT` record in the key-value store counts the results, lists every free input with its reason and shows the run's estimated cost.

### Pricing

Pay per event, no subscription:

| Event | Price | When |
|---|---|---|
| Video minute, up to 480p | $0.03 | One started minute of output video at 240p to 480p. Above 30 frames per second a minute counts per started 1,800 frames (60 fps: two per minute). |
| Video minute, 720p | $0.045 | The same at 720p. |
| Video minute, 1080p | $0.08 | The same at 1080p. |
| Heavy input minute | $0.04 | Added per started output minute when the input is heavier to decode than a 1080p phone video at 30 fps and about 20 Mbit/s: one per started block of extra work (an iPhone 4K video at 30 fps: 1; 4K at 60 fps: 2 to 3). |
| Audio minute | $0.002 | One started minute of output audio (MP3, M4A, WAV, FLAC, OGG, Opus). |
| GIF | $0.01 | One animated GIF per started 15 seconds at up to 480 px on the long side; larger GIFs count by area (960 px: 4). |

A media file counts at least one output unit per started 500 MB downloaded (50 MB for audio output; records of Apify storage 100 MB and 20 MB, or 25 MB and 5 MB through a signed or public Apify link), with its output minutes counting toward it, because a large download costs run time even when the file then cannot be converted (a video without sound for MP3). When a download takes longer than the run has paid for so far (a large file or a slow server), the file's first output minute is charged while it downloads, at the resolution you asked for (1080p for `original`; an audio minute or a GIF for those outputs): it is the result's first minute, and it also pays for a cheaper result (a 480p source asked at 720p keeps the 720p minute). Free: links that are not found, blocked by robots.txt or refused by the site, pages of video platforms, streaming playlists, files whose first bytes are not media, and audio files for a video output (they stop after the first 4 KB). Apify also charges its Actor start event of $0.0045 per run for each GB of memory ($0.018 at the default 4 GB). You can cap the cost of a run with the maximum charge in the run options: the conversion stops at the last paid minute and the status message says so. If you abort a run, every file stops at once and nothing more is charged; the part converted so far is kept.

### Limits

- Direct files only: no YouTube, TikTok or other platform pages, no HLS or DASH playlists, no login or cookies.
- Video output up to 1080p and 60 fps; 4K and 8K inputs are converted down. No upscaling.
- A run never spends more on a file than its price covers: each output minute is charged when the encoder starts it, and a conversion that would cost more (an unusually hard file, a header that lies about its length or size) stops early; the part converted until then is returned, marked `partial`, and charged per started minute.
- Speed at the default 4 GB of memory (about half a CPU core after the first seconds of a run): a minute of a 1080p phone video takes about 1 minute to 480p, 1.5 to 2 minutes to 720p and 2.5 to 3.5 minutes to 1080p; audio is about 100 times faster than real time. Memory up to 16 GB converts faster.
- A large file needs a fast server: the minute charged during a long download pays for about 85 s (480p), 130 s (720p) or 230 s (1080p) of a 4 GB run per 500 MB, so the server must give about 6, 4 or 2.2 MB/s. A slower server stops with a clear message; cloud storage and most CDNs are fast enough (Wikimedia gave 30 to 70 MB/s in our tests).
- WAV and FLAC results are stereo, at most 48 kHz.
- Files up to `maxFileSizeMb` (4,000 MB by default) and twice the run's memory as disk, for the file and its result.
- A dataset is read up to 5,000 items, and only as many as the run has paid for at that point; split larger datasets.

### FAQ

**Do you keep the data?** No. Results stay in your run's dataset and key-value store in your own Apify account, under your data retention settings. Metadata such as the GPS location of phone videos is removed from the converted files.

**Why was an input not charged?** Each free result has its reason in the `error` field, and the `RUN-REPORT` record in the key-value store counts them.

**Why was a file charged although it failed?** A media file counts at least one output unit per started 500 MB downloaded (50 MB for audio output), because the download costs run time; minutes encoded before FFmpeg failed are charged too. The row's `note` says so.

**Why does my 60 fps video count two minutes per minute?** A video minute is 60 s at up to 30 frames per second, and twice the frames take twice the work. Set `maxFps` to 30 to halve it.

**Which software does it use?** [FFmpeg](https://ffmpeg.org) (LGPL 2.1 or later; the Debian build used here includes GPL parts such as x264), with x264, libvpx, LAME, Opus and Vorbis.

**Something is wrong with a result?** Open an issue on the Actor's **Issues** tab with the input.

# Actor input Schema

## `mediaUrls` (type: `array`):

Direct http or https links to video or audio files (MP4, MOV, WebM, MKV, AVI, MPEG-TS, 3GP, MP3, M4A, WAV, FLAC, OGG and other formats ffmpeg reads), one per line. Pages of YouTube, TikTok, Instagram and other platforms are not files: they are returned free with the reason. Each file becomes one row with a link to the converted file.

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

Video formats keep the picture (and the sound unless muted); audio formats take only the sound; GIF makes an animated image of up to gifMaxSeconds.

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

Short side of the output in pixels (a portrait 1080x1920 phone video is 1080p). Never upscaled: a smaller video keeps its size. The price per minute follows the output: up to 480p, 720p, 1080p.

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

Compression level for video (H.264 CRF 20, 23, 28; VP9 CRF 30, 34, 40) and the default audio bitrate. Ignored for WAV and FLAC.

## `targetSizeMb` (type: `number`):

Make the result at most this size, for example 25 for e-mail or Discord. The bitrate follows from the length; when it is too low for the chosen resolution, the resolution steps down (and the price with it). Lossy audio formats too; ignored for WAV, FLAC and GIF.

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

Convert from this point: seconds (75.5) or HH:MM:SS.mmm (00:01:15.500). Empty: from the start.

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

Convert up to this point (same formats). Empty: to the end. Only the converted part is charged.

## `mute` (type: `boolean`):

Video without the sound track.

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

0 keeps the frame rate of the file, up to 60 fps. A video minute is 60 s at up to 30 fps: a 60 fps output counts two minutes per minute, so 30 here halves the price of 60 fps videos.

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

0: by quality (MP3 256, 192 or 128 kbps; AAC 160, 128 or 96; Opus 128, 96 or 64).

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

Frames per second of the GIF.

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

Width of the GIF (never wider than the video). Up to 480 px on the long side one GIF event per 15 s; larger GIFs count by area (960 px: 4).

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

Longest GIF; pick the part with startTime. Each started 15 s counts one GIF event.

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

Also take the file links found in this dataset, for example the output of another Actor. Pick the field below. Up to 5,000 items are read, and only as many as the run has paid for at that point; split larger datasets.

## `datasetField` (type: `string`):

Field of each dataset item that holds the file link. Dot paths and lists work: url, videoUrl, media.video, files.url.

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

Convert files stored as records of this key-value store (for example files you uploaded through the Apify API). Choosing the store here gives the Actor read access.

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

Keys of the records to convert. Leave empty to take every record whose key ends with a video or audio extension (.mp4, .mov, .webm, .mp3 ...).

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

Larger files are skipped for free. The run keeps the input and the result on its disk (twice its memory), so very large files need more memory.

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

Files downloaded at the same time. Conversion uses one ffmpeg per CPU core the run gets (about one per 8 GB of memory), so a download overlaps with the conversion of another file.

## `timeoutSecs` (type: `integer`):

Longest time for one file (download and conversion); the part converted until then is kept. Long files convert faster with more memory (more CPU).

## Actor input object example

```json
{
  "mediaUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/e/e3/Koel_at_bird_bath.webm",
    "https://upload.wikimedia.org/wikipedia/commons/5/5b/A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay%2C_Venezuela.webm"
  ],
  "outputFormat": "mp4",
  "resolution": "720",
  "quality": "balanced",
  "mute": false,
  "maxFps": 0,
  "audioBitrateKbps": 0,
  "gifFps": 12,
  "gifWidth": 480,
  "gifMaxSeconds": 15,
  "datasetField": "url",
  "maxFileSizeMb": 4000,
  "maxConcurrency": 2,
  "timeoutSecs": 3600
}
```

# Actor output Schema

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

No description

## `report` (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 = {
    "mediaUrls": [
        "https://upload.wikimedia.org/wikipedia/commons/e/e3/Koel_at_bird_bath.webm",
        "https://upload.wikimedia.org/wikipedia/commons/5/5b/A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay%2C_Venezuela.webm"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("greenrun/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 = { "mediaUrls": [
        "https://upload.wikimedia.org/wikipedia/commons/e/e3/Koel_at_bird_bath.webm",
        "https://upload.wikimedia.org/wikipedia/commons/5/5b/A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay%2C_Venezuela.webm",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("greenrun/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 '{
  "mediaUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/e/e3/Koel_at_bird_bath.webm",
    "https://upload.wikimedia.org/wikipedia/commons/5/5b/A_pale_breasted_thrush_next_to_nestlings_in_northern_Maracay%2C_Venezuela.webm"
  ]
}' |
apify call greenrun/video-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,greenrun/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/bTi5R3VkgeAiVYZdU/builds/cjQLvEDILOxItecqz/openapi.json
