# FFmpeg Video & Audio Converter — Compress, Trim, MP4, MP3, GIF (`steadyscrape/ffmpeg-video-converter`) Actor

FFmpeg video converter and video compressor API for links to your own media: convert to MP4, WebM, MOV, MKV, MP3, M4A, WAV, FLAC or OGG, compress to a target size, trim, resize to 9:16, extract audio, mute, normalize loudness, change speed, make GIFs, merge files, probe. Export via API.

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

## Pricing

from $25.00 / 1,000 minute of encoded video (up to 720p)s

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

## FFmpeg Video Converter & Compressor — MP4, MP3, GIF, trim, resize

**Convert, compress, trim and resize video and audio files with FFmpeg in the cloud.** Give direct links to your own
files — or pick a dataset of links from another Actor — and this FFmpeg video converter returns every result as a
download link with its duration, size, resolution and codecs: **MP4, WebM, MOV, MKV, MP3, M4A, WAV, FLAC, OGG or GIF**.
No FFmpeg to install, no command line to learn, no subscription: you pay per minute of media, only for files that come
out.

**One operation per run, on every file:** convert, compress (by quality or to a **target file size**), trim, resize or
reshape to **9:16, 1:1, 4:5 or 16:9**, extract audio (including **16 kHz mono WAV** for speech-to-text), mute, normalize
loudness, change speed, make a GIF, join files into one, or just probe a file's metadata.

**Made for automations.** Call it from n8n, Make, Zapier or your own code, feed it the files another Actor produced
(a scraper's videos, a render's MP4s, a podcast list), and hand its links to the next step.

### What this FFmpeg video converter does

| Operation | What you get | Billed as |
|---|---|---|
| **Convert** | The file in another format. When its codecs already fit the new container (H.264 into MP4, AAC into M4A…) the streams are **copied without re-encoding**: instant and lossless. | video minutes when the picture is encoded, audio minutes when it is copied |
| **Compress** | A smaller video, by quality preset (`high`, `balanced`, `small`, `smallest`) or to a **target size in MB** with a two-pass encode — 8 MB for Discord, 16 MB for WhatsApp, 25 MB for email. If the size leaves too few bits for the full resolution, the video is downscaled so it still looks sharp, and the row says so. | video minutes |
| **Trim** | The part between a start and an end time, cut to the exact frame, or with **fast trim** by copying the streams (lossless, starts on a keyframe). | video minutes, or audio minutes for a fast trim |
| **Resize / reshape** | A maximum resolution (1080p, 720p, 480p, 360p — never upscaled) and/or a new shape: **9:16 for TikTok, Reels and Shorts**, 1:1 or 4:5 for feeds, 16:9 for YouTube. Fit by **crop**, **pad** (black bars) or **blur** (the picture over a blurred copy of itself). | video minutes |
| **Extract audio** | The sound track as MP3, M4A, WAV, **16 kHz mono WAV**, FLAC or OGG/Opus. AAC into M4A is copied as it is. | audio minutes |
| **Mute** | The video without its sound, the picture copied as it is when the format can hold it. | audio minutes |
| **Normalize loudness** | The sound brought to a loudness target: **-14 LUFS** for YouTube and Spotify, **-16** for podcasts, **-23** for EBU R128 broadcast. Two passes (measure, then apply), true peaks kept under -1.5 dBTP; the picture is copied. | audio minutes |
| **Change speed** | Faster or slower, 0.25× to 4×, with the voice keeping its pitch. | video or audio minutes of the output |
| **Video to GIF** | A looping GIF of up to 30 seconds and 480 px wide, from the start time you choose, with one optimized palette. | one GIF |
| **Concatenate** | All the links joined into one file, in the order given. Videos of different sizes are brought to the first one's frame; a silent part gets silence so sound stays in sync. | video or audio minutes of the joined file |
| **Probe** | Metadata only, read in place without downloading the file: duration, size, codecs, resolution, rotation, frame rate, bitrate, sample rate, channels — plus one **poster frame** as JPEG. | one probe |

Every output video also gets a **thumbnail JPEG**. Phone videos recorded sideways come out upright, and an HEVC video
copied into MP4 is tagged so Apple devices play it.

### Use cases

- **Compress videos to a size limit** before sending them by email, Discord, WhatsApp or an upload form.
- **Convert MOV, MKV, AVI or WebM to MP4** that plays everywhere, or **MP4 to MP3** to keep only the sound.
- **Prepare audio for transcription**: 16 kHz mono WAV is what Whisper and most speech-to-text APIs want.
- **Reshape landscape clips to 9:16** for Shorts, Reels and TikTok, with a blurred background instead of black bars.
- **Normalize podcast episodes** to -16 LUFS so every episode plays at the same volume.
- **Cut highlights**: trim clips, speed them up, or turn them into GIFs for docs, tickets and chats.
- **Check files at scale**: probe a dataset of media links for duration, resolution and codecs before processing them.

### Input example

Compress two videos to 8 MB each:

```json
{
  "files": [
    "https://example.com/uploads/demo-recording.mov",
    "https://example.com/uploads/product-tour.mp4"
  ],
  "operation": "compress",
  "targetSizeMb": 8
}
```

Reshape to vertical 9:16 with a blurred background, capped at 720p:

```json
{
  "files": ["https://example.com/uploads/interview.mp4"],
  "operation": "resize",
  "aspectRatio": "9:16",
  "fit": "blur",
  "maxResolution": "720"
}
```

Extract the sound of every video in another Actor's dataset as 16 kHz mono WAV:

```json
{
  "datasetId": "<dataset id>",
  "operation": "extract_audio",
  "audioFormat": "wav-16k-mono"
}
```

Times are seconds (`95.5`) or timecodes (`1:35.5`, `00:01:35.500`); `startTime` and `endTime` apply to every operation
except concatenate and probe.

### Output example

One row per file (one row in all for concatenate):

```json
{
  "status": "ok",
  "reason": null,
  "index": 1,
  "operation": "convert",
  "sourceUrl": "https://media.w3.org/2010/05/sintel/trailer.webm",
  "outputUrl": "https://api.apify.com/v2/key-value-stores/<store>/records/001-trailer.mp4?signature=…",
  "outputKey": "001-trailer.mp4",
  "outputFormat": "mp4",
  "contentType": "video/mp4",
  "thumbnailUrl": "https://api.apify.com/v2/key-value-stores/<store>/records/001-trailer-thumbnail.jpg?signature=…",
  "durationSeconds": 52.686,
  "width": 640,
  "height": 272,
  "videoCodec": "h264",
  "audioCodec": "aac",
  "fileSizeBytes": 2606651,
  "sizeChangePercent": -16,
  "videoReencoded": true,
  "source": { "formatName": "matroska,webm", "durationSeconds": 52.663, "video": { "codec": "vp8", "width": 640, "height": 272 }, "audio": { "codec": "vorbis" } },
  "billedEvent": "video-minute",
  "billedCount": 1,
  "billedTransferCount": 0,
  "processingSeconds": 3.1
}
```

The links open for anyone, without an Apify account, for as long as the run's storage is kept.

### Output fields

| Field | Meaning |
|---|---|
| `status` | `ok`, or why nothing was made: `invalid` (the operation does not apply, e.g. compress on an MP3), `unreachable`, `not_media`, `too_large`, `refused` (a video platform page), `skipped` (spending limit or run timeout), `failed` (FFmpeg could not do it). Only `ok` rows are billed. |
| `reason` | Why a row is not `ok`, or notes on an `ok` one (downscaled to meet a target size, end time past the end of the file…). |
| `index`, `operation` | The file's place in the run (from 1) and the operation done to it. |
| `sourceUrl`, `datasetItemIndex` | The link that was processed, and the item of the picked dataset it came from (from 0; empty for typed links). |
| `outputUrl`, `outputKey` | The output file's public link and its key in the run's key-value store. |
| `outputFormat`, `contentType` | The output's extension (`mp4`, `mp3`, `gif`…) and its MIME type. |
| `thumbnailUrl` | A JPEG of the output video (the GIF itself for GIFs, the poster frame for probes). |
| `durationSeconds`, `width`, `height`, `videoCodec`, `audioCodec`, `fileSizeBytes` | Measured on the output file (on the source for probes). |
| `sizeChangePercent` | Output size against the downloaded source, -60 means 60 % smaller. |
| `videoReencoded` | `false` when the picture was copied as it is. |
| `source` | The source's metadata: format, duration, size, bitrate, video codec, size as shown, stored size, rotation, frame rate, pixel format, audio codec, sample rate, channels. |
| `billedEvent`, `billedCount`, `billedTransferCount` | What this row was charged: its minutes (or GIF, or probe) and its `transfer-10mb` events. |
| `joinedUrls` | The links joined, in order (concatenate). |
| `processingSeconds`, `processedAt` | How long the file took, download and upload included, and when work on it began (UTC). |

### Pricing

Pay per event, nothing per run or per month:

| Event | Price | When |
|---|---|---|
| `video-minute` | US$0.025 | each started minute of output video whose picture is encoded, up to 720p on its short side |
| `hd-video-minute` | US$0.045 | each started minute of output video encoded above 720p (up to 1080p) |
| `audio-minute` | US$0.002 | each started minute of audio output, and of a video whose picture is copied (remux, fast trim, mute, normalize) |
| `gif` | US$0.01 | each GIF |
| `probe` | US$0.002 | each file probed |
| `transfer-10mb` | US$0.001 | each started 10 MB of an output file past its first 10 MB |

Examples: a 10-minute phone video compressed to 720p (about 120 MB out) costs about US$0.26; kept at 1080p, about
US$0.47. The audio of a one-hour video as MP3 (about 86 MB) costs about US$0.13. A two-hour, 2 GB MKV remuxed to MP4
without re-encoding costs about US$0.44. Links that fail, pages, damaged files and anything else that produces no output
cost nothing.

Set a **maximum cost per run** in the run options: files that would go past it are skipped and listed, never half-made.

### Limits

- **Your own files, by direct link**: up to 2 GB each, 500 links per run (100 for concatenate). Links of video
  platforms (YouTube, TikTok, Instagram, Facebook, X, Vimeo…) are refused before anything is downloaded: this Actor
  does not download from them. Since build 1.0.7 (2026-11-09) so are the platforms' media servers (googlevideo.com,
  tiktokcdn.com, v.redd.it…) and any link that redirects to a platform, as free `refused` rows. Files behind a login
  need a link that opens for anyone.
- Links to private, local or reserved addresses (localhost, 10.x, 192.168.x, the cloud metadata address
  169.254.169.254…), typed, reached by a redirect or named inside a playlist, are free `unreachable` rows: nothing is
  requested from them.
- Encoded video is capped at **1080p**; a copied stream keeps its own resolution. GIFs are up to 30 s and 480 px wide.
- Encoders: H.264 (x264), VP9, AAC, MP3, Opus, FLAC, PCM. No H.265 or AV1 encoding; HEVC and AV1 sources are read and
  can be copied into MKV and MP4 (HEVC also into MOV).
- Long files take time: the default run has 4 GB of memory (one CPU core). Give a run more memory to encode faster; a file
  the run's timeout cannot finish is skipped and listed, not cut short.
- Encrypted (DRM) media cannot be read.

### Use it from the API, n8n or Make

Start a run with `POST https://api.apify.com/v2/acts/steadyscrape~ffmpeg-video-converter/run-sync-get-dataset-items`
and the input above as the body, and the response is the rows. In n8n and Make use the Apify node or module with this
Actor. Files in another run's key-value store can be passed as their signed record links, and a whole dataset with
`datasetId`.

### Related Actors

- [Video Render API](https://apify.com/steadyscrape/video-render-api) — build a video from JSON: scenes, text, captions,
  voiceover, music, logo.
- [Video Frame Extractor](https://apify.com/steadyscrape/video-frame-extractor) — frames and scene changes of a video as
  images.
- [Audio & Video Transcriber](https://apify.com/steadyscrape/audio-video-transcriber) — speech to text with timestamps
  and subtitles, from the same kind of links.

### FFmpeg, licenses and your files

This Actor runs [FFmpeg](https://ffmpeg.org/) on Apify's servers. It is not affiliated with, sponsored or endorsed by
the FFmpeg project; FFmpeg is a trademark of Fabrice Bellard, originator of the FFmpeg project. Process only files you
own or have the right to convert, and respect the rights of their authors.

# Actor input Schema

## `files` (type: `array`):

Direct links to your own files: mp4, mov, webm, mkv, avi, m4v, ts, mp3, m4a, wav, flac, ogg, opus and anything else FFmpeg reads, up to 2 GB each. Signed links of Apify key-value records work too. Pages of YouTube, TikTok, Instagram, Vimeo and other platforms are refused before anything is downloaded, free.

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

Pick the dataset of another run (a scraper's videos, a render's MP4s, a podcast list) and every audio or video link in it is processed. Only the dataset you pick here can be read.

## `datasetFields` (type: `array`):

The fields of each dataset item that hold the links, as dotted paths (media.url takes the url of every element of media). Leave empty to take every link in a field named like video, audio, media, file or recording, or ending in .mp4, .mp3 and the like.

## `operation` (type: `string`):

What is done to each file. Every operation gives one output file per link, except concatenate, which joins all the links into one file in the order given.

## `videoFormat` (type: `string`):

Container and codecs of every video output. A file already in the right codecs is copied into the new container without re-encoding (fast, lossless, billed as audio minutes).

## `audioFormat` (type: `string`):

Format of every audio output: extract audio, and convert, trim, normalize or speed on an audio file.

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

Used whenever a picture is encoded. high ≈ visually lossless, balanced is x264's default (CRF 23), small and smallest trade detail for size.

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

Compress each video to about this size with a two-pass encode (8 for Discord, 16 for WhatsApp, 25 for email). 0 compresses by quality instead. If the size leaves too few bits for the full resolution, the video is downscaled and the row says so.

## `maxResolution` (type: `string`):

The short side of encoded videos (1080 is 1920×1080, or 1080×1920 for a vertical video). Never upscales. Encoded videos are capped at 1080p; a stream copy keeps the source as it is.

## `aspectRatio` (type: `string`):

Reshape encoded videos: 9:16 for TikTok, Reels and Shorts, 1:1 or 4:5 for feeds, 16:9 for YouTube. How the picture fills the new shape is set by Fit.

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

When the aspect ratio changes (or files of different shapes are joined): crop fills the frame and cuts the edges, pad shows the whole picture with black bars, blur shows it whole on a blurred copy of itself.

## `audioBitrate` (type: `string`):

For MP3, AAC and Opus. auto uses 192 for MP3 and M4A, 128 inside videos and for Opus, and never more than the source's own.

## `audioChannels` (type: `string`):

Mix the sound to mono or stereo.

## `audioSampleRate` (type: `string`):

Resample the sound. Opus (WebM, OGG) plays at 48 kHz, so 22050 and 44100 become 48000 there.

## `loudnessTarget` (type: `number`):

-14 for YouTube and Spotify, -16 for podcasts and Apple, -23 for EBU R128 broadcast. Measured in a first pass, then applied as one gain when the peaks allow it, or with gentle levelling when they do not; true peaks stay under -1.5 dBTP and the result lands within about 1 LU of the target.

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

Seconds (95.5) or a timecode (1:35.5, 00:01:35.500). Empty starts at the beginning. Used by every operation except concatenate and probe; trim needs a start time, an end time or both.

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

Seconds or a timecode, counted from the start of the file. Empty runs to the end.

## `fastTrim` (type: `boolean`):

Cut by copying the streams: instant, lossless and billed as audio minutes, but the cut starts on the keyframe at or before the start time (up to a few seconds early). Off cuts to the exact frame.

## `speed` (type: `number`):

2 plays twice as fast, 0.5 at half speed. The pitch of the sound is kept.

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

Up to 480. Each GIF is up to 30 seconds from the start time.

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

Fewer frames make a smaller GIF.

## Actor input object example

```json
{
  "files": [
    "https://media.w3.org/2010/05/sintel/trailer.webm"
  ],
  "operation": "convert",
  "videoFormat": "mp4",
  "audioFormat": "mp3",
  "quality": "balanced",
  "targetSizeMb": 0,
  "maxResolution": "keep",
  "aspectRatio": "keep",
  "fit": "crop",
  "audioBitrate": "auto",
  "audioChannels": "keep",
  "audioSampleRate": "keep",
  "loudnessTarget": -16,
  "startTime": "",
  "endTime": "",
  "fastTrim": false,
  "speed": 1,
  "gifWidth": 480,
  "gifFps": 12
}
```

# Actor output Schema

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

No description

## `storedFiles` (type: `string`):

No description

## `summary` (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 = {
    "files": [
        "https://media.w3.org/2010/05/sintel/trailer.webm"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadyscrape/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 = { "files": ["https://media.w3.org/2010/05/sintel/trailer.webm"] }

# Run the Actor and wait for it to finish
run = client.actor("steadyscrape/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 '{
  "files": [
    "https://media.w3.org/2010/05/sintel/trailer.webm"
  ]
}' |
apify call steadyscrape/ffmpeg-video-converter --silent --output-dataset

```

## MCP server setup

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