# Media Converter: WebM, MKV, MP3, WAV, FLAC, Opus and GIF (`examsens.ai/media-converter`) Actor

Converts video and audio files you link or upload with ffmpeg: MP4, WebM, MOV, MKV, GIF, MP3, WAV, AAC, M4A, FLAC and Opus. Sets resolution, frame rate, quality or bitrate, trims, normalizes loudness, and returns a download link for each file.

- **URL**: https://apify.com/examsens.ai/media-converter.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** Videos, For creators
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $70.00 / 1,000 media minute converteds

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

## Media Converter: WebM, MKV, MP3, WAV, FLAC, Opus and GIF

Give it video and audio files, by link or from one of your key value stores, and it converts each one with ffmpeg. Pick the format, and optionally the codec, resolution, frame rate, quality or bitrate, audio settings and a trim. Every new file goes into the run's key value store, and the dataset gives you a download link with the codecs, size, length and resolution before and after.

### What it does

- Video formats: WebM and MKV, with VP9 video and Opus audio by default
- Video codecs: VP9, AV1 and VP8, or copy the video stream with no re-encode
- Audio only: MP3, WAV (16 bit PCM), FLAC and Opus, from audio files or from the soundtrack of a video
- GIF: animated GIF with a palette built from the clip, at the frame rate and width you set
- Resize: by width, height or both, with the aspect ratio kept. Never enlarges by default
- Quality: four constant quality levels (high, medium, low, smallest file), or a target bitrate in kbps
- Frame rate: set a new one, such as 30 or 15
- Trim: start and end as seconds or timecodes
- Audio: bitrate, sample rate (22,050, 44,100 or 48,000 Hz), mono or stereo, remove the audio track, or normalize loudness to -16 LUFS with the ffmpeg loudnorm filter
- Metadata: copied to the new file by default, or stripped

### Accepted files

- Containers: WebM, MKV, Ogg (`.ogg`, `.oga`, `.ogv`, `.opus`), WAV, FLAC and MP3
- Video codecs: AV1, VP8, VP9 and Theora
- Audio codecs: Opus, Vorbis, FLAC, MP3 and PCM

A file in any other format, or one that holds any other codec, gets an error item that names what it holds and lists what is accepted, and is not charged.

### Example

A 10 second 640 by 360 VP8 WebM of 1,049,824 bytes, converted with the defaults, came out as VP9 WebM at 640 by 360 and 915,838 bytes. The same clip as AV1 at 320 wide came out at 320 by 180 and 150,991 bytes. Seconds 2 to 5 as a GIF at 320 wide and 10 frames per second came out at 320 by 180 and 1,256,866 bytes. An 11 second FLAC speech clip of 1,152,693 bytes as Opus at 32 kbps came out at 44,682 bytes.

### Input

- Media URLs: direct links to video or audio files
- Files in a key value store: to use files from your computer, upload them to one of your key value stores and pick that store. Every record whose key ends in `.webm`, `.mkv`, `.mka`, `.ogg`, `.oga`, `.ogv`, `.opus`, `.wav`, `.flac` or `.mp3` is processed
- Record keys: only process these records from that store
- Output format: WebM (default), MKV, GIF, MP3, WAV, FLAC or Opus
- Video codec: auto (default, VP9), VP8, VP9, AV1 or copy. Copy into WebM takes VP8, VP9 and AV1 video. Copy into MKV also takes Theora
- Video quality: high, medium (default), low or smallest file
- Video bitrate in kbps (default 0, which uses the quality level)
- Width and height in pixels (default 0, which keeps the size), and never enlarge (default on)
- Frame rate (default 0, which keeps the source rate)
- Trim start and trim end
- Remove audio (default off)
- Audio bitrate in kbps (default 192), sample rate (default keep) and channels (default keep)
- Normalize loudness (default off)
- GIF frame rate (default 10) and loop (default on). A GIF is 480 pixels wide at most unless you set a width
- Strip metadata (default off)
- Maximum file size in MB (default 1,000)
- Time limit per file in seconds (default 1,800)

With video codec copy, the resolution, frame rate and quality settings do not apply, and a trim starts at the keyframe nearest the start time.

### Output

Dataset: one item per file with `outputUrl` (download link), `outputKey`, `outputFormat`, `chargedMinutes`, `savedPercent`, and for both the source (`input...`) and the new file (`output...`): `Container`, `VideoCodec`, `AudioCodec`, `Width`, `Height`, `DurationSeconds`, `AudioSampleRate`, `AudioChannels`, `BitrateKbps` and `Bytes`. Files are named by their position in your list and the source file name, such as `0001-trailer.webm`.

A file that cannot be converted gets `ok: false` and an `error`, such as `HTTP 404`, "the link returns a web page, not a media file", a file over the size limit, "the file has no video stream, so it cannot become WEBM" for an audio file sent to a video format, or "the file has H.264 video, which this actor does not accept" followed by the accepted formats. One bad file never stops the run.

### Pricing

Pay per event: one event per started minute of converted media, counted on the length you asked for. A 10 second file is one event, a 122 second file is three, and a 10 second trim of a long video is one. Failed files are not charged. Before each file the actor checks that its minutes fit within the maximum charge you set, and stops when they do not.

### Scope and conduct

Only the files you supply are downloaded. The actor does not log in anywhere, does not download from video sharing sites and uses no proxies. Convert media you have the right to use.

### Support

Questions and problems: the Issues tab on this page. Replies are written by an AI assistant on behalf of the developer and reviewed by the developer.

# Actor input Schema

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

Direct links to video or audio files in WebM, MKV, Ogg, WAV, FLAC or MP3, with AV1, VP8, VP9 or Theora video and Opus, Vorbis, FLAC, MP3 or PCM audio. Other files get an error item naming their format. Pages of video sites are not supported.

## `inputStore` (type: `string`):

To use video and audio files from your computer, upload them to one of your key value stores, then pick that store here. Every record whose key ends in .webm, .mkv, .mka, .ogg, .oga, .ogv, .opus, .wav, .flac or .mp3 is processed, or only the keys you list below.

## `inputKeys` (type: `array`):

Only process these records from the store above, one key per line. Empty processes every record with a known file extension.

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

Video: WebM or MKV, with VP9 video and Opus audio by default. Animated: GIF. Audio only: MP3, WAV (16 bit PCM), FLAC (lossless) or Opus.

## `videoCodec` (type: `string`):

Auto picks VP9. AV1 gives smaller files than VP9 at the same quality and takes longer. VP8 is the older WebM codec. Copy keeps the video stream as it is: fastest and no quality loss, but resolution, frame rate and quality settings are ignored, and a trim starts at the nearest keyframe.

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

Constant quality level for the encoder. High keeps the most detail, smallest gives the smallest files. Ignored when you set a video bitrate.

## `videoBitrateKbps` (type: `integer`):

Target video bitrate, such as 2500 for 2.5 Mbps. 0 uses the quality level.

## `width` (type: `integer`):

Target width. With only a width, the height follows the aspect ratio. With both, the video fits inside the box with the aspect ratio kept. 0 keeps the size. GIF defaults to 480 wide at most.

## `height` (type: `integer`):

Target height, such as 720 or 1080. 0 keeps the size.

## `withoutEnlargement` (type: `boolean`):

Leave videos that already fit inside the width and height at their own size.

## `fps` (type: `number`):

Output frames per second, such as 24, 30 or 60. 0 keeps the source rate.

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

Where the output starts: seconds such as 12.5, or a timecode such as 00:01:30. Empty starts at the beginning.

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

Where the output ends, measured from the start of the source file. Empty runs to the end.

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

Write a silent video.

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

For MP3, Opus and the audio track of videos. 128 is fine for speech, 192 to 320 for music. WAV and FLAC ignore it.

## `sampleRate` (type: `string`):

Audio sample rate in Hz. Opus always uses 48000.

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

Mix the audio down to mono or stereo, or keep the source layout.

## `normalizeLoudness` (type: `boolean`):

Even out the volume to -16 LUFS with the ffmpeg loudnorm filter (EBU R128), so quiet and loud files play at a similar level.

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

Frames per second for GIF output. 10 to 15 keeps files small.

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

Loop forever, or play once.

## `stripMetadata` (type: `boolean`):

Remove title, artist, creation time and the other tags. When off, the tags are copied to the new file.

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

Larger source files are skipped with an error item and are not charged.

## `timeoutSecondsPerFile` (type: `integer`):

Stops a conversion that runs longer than this and reports an error for that file.

## Actor input object example

```json
{
  "mediaUrls": [
    {
      "url": "https://test-videos.co.uk/vids/bigbuckbunny/webm/vp9/360/Big_Buck_Bunny_360_10s_1MB.webm"
    }
  ],
  "outputFormat": "webm",
  "videoCodec": "auto",
  "quality": "medium",
  "videoBitrateKbps": 0,
  "width": 0,
  "height": 0,
  "withoutEnlargement": true,
  "fps": 0,
  "removeAudio": false,
  "audioBitrateKbps": 192,
  "sampleRate": "keep",
  "audioChannels": "keep",
  "normalizeLoudness": false,
  "gifFps": 10,
  "gifLoop": true,
  "stripMetadata": false,
  "maxFileSizeMb": 1000,
  "timeoutSecondsPerFile": 1800
}
```

# Actor output Schema

## `results` (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": [
        {
            "url": "https://test-videos.co.uk/vids/bigbuckbunny/webm/vp9/360/Big_Buck_Bunny_360_10s_1MB.webm"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/media-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": [{ "url": "https://test-videos.co.uk/vids/bigbuckbunny/webm/vp9/360/Big_Buck_Bunny_360_10s_1MB.webm" }] }

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/media-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": [
    {
      "url": "https://test-videos.co.uk/vids/bigbuckbunny/webm/vp9/360/Big_Buck_Bunny_360_10s_1MB.webm"
    }
  ]
}' |
apify call examsens.ai/media-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,examsens.ai/media-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/dbm23lQulR1jwKOO5/builds/6CVEccCKt8LegqXSo/openapi.json
