# Extract Audio from Video: MP3, WAV & FLAC in Bulk (`data-done-right/extract-audio-from-video`) Actor

Extract audio from video file URLs in bulk: MP3, WAV, FLAC or M4A with download links. Choose bitrate, sample rate, mono/stereo and an optional time range. Direct files only (mp4, mov, webm, mkv), no YouTube. Pay per audio minute.

- **URL**: https://apify.com/data-done-right/extract-audio-from-video.md
- **Developed by:** [Data Done Right](https://apify.com/data-done-right) (community)
- **Categories:** Videos, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.40 / 1,000 audio minute extracteds

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

## Extract Audio from Video: MP3, WAV & FLAC in Bulk

This tool lets you **extract audio from video** files in bulk: give it direct video URLs and it returns a download link for the audio of each one as **MP3, WAV, FLAC or M4A**. It runs ffmpeg in the cloud, so there is nothing to install and no API key.

> **What it does not do.** It reads **direct video files** (mp4, mov, webm, mkv, avi, flv) from a public URL. It **does not download from YouTube, Vimeo, TikTok, Instagram or other streaming sites** and rejects those links without charge. HLS/DASH playlists (.m3u8, .mpd) are not supported. It extracts the first audio track only: it does not transcribe, denoise, normalise volume, split tracks or edit video. A video without sound gives an error row, free of charge. Use it only on videos you own or have the right to process.

**What you get**

- One dataset row per video: source URL, a download link for the audio file, measured duration, audio minutes billed, size, sample rate, channels, and a status or a clear error.
- Choice of MP3, WAV (16-bit PCM), FLAC (lossless) or M4A (AAC), with bitrate, sample rate (for example 16 kHz for speech-to-text), mono/stereo and an optional start and end time.
- Failed videos are free, never stop the run, and say exactly why they failed.

### How to extract audio from a video URL

1. Paste one or more **direct video URLs** in `videoUrls`.
2. Pick `outputFormat` (default `mp3`) and, if you like, the bitrate, sample rate and channels.
3. Run it. Open the dataset: every row has a `url` to the audio file. The `SUMMARY` record counts the videos, the audio minutes billed and lists every failure.

### How to convert video to MP3

Leave `outputFormat` at `mp3` and set `audioBitrateKbps`: 128 is fine for speech, 192 to 320 for music. Sound that the video stores as AAC is decoded and re-encoded to MP3, which is lossy again, so keep the bitrate high if quality matters.

### How to get 16 kHz mono WAV for speech-to-text

Set `"outputFormat": "wav"`, `"sampleRateHz": 16000` and `"channels": "mono"`. Most transcription models take exactly this format, and the files are small. Feed the links to your transcriber, for example **Transcribe Audio to Text: Files, Podcasts & Video URLs**.

### How to extract only part of a video as audio

Set `startSeconds` and `endSeconds` (0 for the end means "until the end of the video"). Billing counts the minutes of the audio actually delivered.

### Input

| Field | Default | What it does |
|---|---|---|
| `videoUrls` | sample video | Direct video file links (required). |
| `outputFormat` | `mp3` | `mp3`, `wav`, `flac` or `m4a`. |
| `audioBitrateKbps` | 192 | MP3 and M4A bitrate (32 to 320). Ignored for WAV and FLAC. |
| `sampleRateHz` | 0 (original) | Resample, for example 16000 or 44100. |
| `channels` | `original` | `original`, `mono` or `stereo`. |
| `startSeconds` / `endSeconds` | 0 / 0 | Optional time range; 0 end = to the end of the video. |
| `maxVideosPerRun` | 100 | Hard cap on videos per run (max 2000). |
| `maxAudioMinutesPerRun` | 600 | Hard cap on billable minutes; a video that would exceed it is skipped, free. |
| `maxVideoSizeMb` | 500 | Source size cap (max 2048). |
| `maxDurationMinutes` | 240 | Source duration cap. |
| `videoTimeoutSecs` | 600 | Per download and per extraction. |
| `outputStoreName` | empty | Save the audio in a named store that is kept until you delete it. |

Input example:

```json
{
  "videoUrls": ["https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"],
  "outputFormat": "mp3",
  "audioBitrateKbps": 192
}
```

### Output

From a real local run of the input above:

```json
{
  "sourceUrl": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
  "videoIndex": 1, "format": "mp3", "status": "ok",
  "url": "https://api.apify.com/v2/key-value-stores/<store>/records/flower-001.mp3",
  "key": "flower-001.mp3", "durationSeconds": 5.055, "minutesBilled": 1, "bytes": 122732,
  "audioCodec": "mp3", "sampleRate": 48000, "channels": 2, "bitrateKbps": 192,
  "sourceDurationSeconds": 5.055, "sourceAudioCodec": "aac", "error": null, "note": null
}
```

A video that cannot be processed looks like this and is not charged:

```json
{
  "sourceUrl": "https://example.com/nope.mp4", "videoIndex": 2, "format": "mp3", "status": "error",
  "url": null, "minutesBilled": 0, "error": "download failed: HTTP 404"
}
```

On Apify the `url` is a signed link that downloads without a token. `status` is `ok`, `error` or `skipped` (spending limit, `maxVideosPerRun` or `maxAudioMinutesPerRun` reached).

### Use with the Apify API, MCP, n8n and Make

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("data-done-right/extract-audio-from-video").call(run_input={
    "videoUrls": ["https://example.com/webinar.mp4"],
    "outputFormat": "wav", "sampleRateHz": 16000, "channels": "mono"})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["status"], row["url"] or row["error"])
```

JavaScript:

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: '<APIFY_TOKEN>' });
const run = await client.actor('data-done-right/extract-audio-from-video').call({
  videoUrls: ['https://example.com/webinar.mp4'], outputFormat: 'mp3' });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

In n8n or Make use the Apify node with the actor name and the same JSON. With Apify's MCP server (mcp.apify.com) an AI assistant can call it: "get the audio of this mp4 as MP3". Only a video URL is needed.

### Use cases

- Prepare recordings of webinars, meetings or lectures for speech-to-text (16 kHz mono WAV).
- Turn product demos and screen recordings into MP3 for podcasts or audio feeds.
- Archive the sound of your own video library as lossless FLAC.
- Pull the audio of a segment (for example one interview answer) with a start and end time.
- Batch-convert a list of video links from a spreadsheet or dataset into audio files.

### How much does it cost

Pay per event: **$0.003 per audio minute** (`audio-minute`, $3 per 1,000 minutes). Every started minute of the delivered audio counts, so a 5-second file is billed as 1 minute and a 61-second file as 2. Failed and skipped videos, rejected links and the `SUMMARY` record are free. There is no start fee. Plan discounts apply (Silver about 10%, Gold and higher about 20%).

- 1,000 minutes (about 17 hours of audio, for example 200 videos of 5 minutes): $3.
- 10,000 minutes: $30.
- 100,000 minutes: $300.

`maxAudioMinutesPerRun` and `maxVideosPerRun` cap a run, and if you set a maximum spend per run the Actor stops cleanly when it is reached and removes the file it could not charge for. Apify platform usage is included in this price.

### FAQ

#### Can it extract audio from YouTube videos?

No. YouTube, Vimeo, TikTok, Instagram and other streaming-site links are rejected with a message and no charge. Use a direct link to a video file that you have the rights to.

#### What if the video has several audio tracks?

Only the first audio track in the file is extracted. Other tracks (for example a second language) are ignored.

#### Does WAV or FLAC make the audio better quality?

No. They keep what is in the video without further loss, but if the video holds lossy AAC audio the result is still that AAC sound, only stored in a larger file. WAV is big: about 11.5 MB per minute at 48 kHz stereo. Outputs that would be above 700 MB are refused with advice (use MP3, mono, a lower sample rate or a time range).

#### Which limits apply?

Source files up to 2 GB (default 500 MB) and 4 hours by default, up to 2000 videos per run. Links to private or internal addresses are blocked. The whole video is downloaded once, so a very large file takes time even if you only need a short range.

#### What happens to a video with no sound?

The row has status `error` with "the file has no audio track" and it is not charged.

#### How long are the audio links kept?

Files live in the run's key-value store, which expires with your plan's retention period. Set `outputStoreName` to keep them in a named store until you delete it.

### Related tools

- **Video Frame Extractor: Keyframes, Scenes & Thumbnails for AI** pulls still images from the same videos.
- **Cut Video: Video Trimmer, Clip Cutter & Video to GIF** cuts clips before you extract their audio.
- **Transcribe Audio to Text: Files, Podcasts & Video URLs** turns the audio into a transcript.

# Actor input Schema

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

Direct links to video files (mp4, mov, webm, mkv, avi, flv). Example: https://example.com/talk.mp4. One audio file is produced per link. YouTube, Vimeo, TikTok and other streaming-site page links are rejected, with no charge.

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

File type of the extracted audio. MP3 and M4A (AAC) are small lossy files; WAV is uncompressed PCM 16-bit; FLAC is lossless and about half the size of WAV. Audio that is already lossy in the video is not improved by choosing WAV or FLAC.

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

MP3 and M4A only; ignored for WAV and FLAC. 128 is fine for speech, 192 to 320 for music. Example: 192.

## `sampleRateHz` (type: `integer`):

Resample the audio, for example 16000 for speech-to-text or 44100 for music. 0 keeps the original rate. Minimum 8000 when set.

## `channels` (type: `string`):

Keep the original channel layout, or mix down to mono (smaller files, common for transcription) or stereo.

## `startSeconds` (type: `number`):

Optional: begin the audio at this time in the video. Example: 30 skips the first 30 seconds. 0 = from the start.

## `endSeconds` (type: `number`):

Optional: stop the audio at this time in the video. Example: 120. 0 = until the end of the video. Must be after the start.

## `maxVideosPerRun` (type: `integer`):

Hard cap on videos processed in one run. Links past the cap are listed as skipped and not charged.

## `maxAudioMinutesPerRun` (type: `integer`):

Hard cap on the audio minutes you can be charged for in one run. A video that would go over it is skipped, free. Example: 600 = 10 hours of audio, at most $1.80.

## `maxVideoSizeMb` (type: `integer`):

Source files above this size are rejected before the download finishes. Maximum 2048.

## `maxDurationMinutes` (type: `number`):

Longer source videos are rejected without charge. Example: 240 = 4 hours.

## `videoTimeoutSecs` (type: `integer`):

Applies separately to each download and to the audio extraction of each video.

## `outputStoreName` (type: `string`):

Optional key-value store name. Named stores are kept until you delete them, while the store of a run expires after your plan retention period. Example: my-audio.

## Actor input object example

```json
{
  "videoUrls": [
    "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
  ],
  "outputFormat": "mp3",
  "audioBitrateKbps": 192,
  "sampleRateHz": 0,
  "channels": "original",
  "startSeconds": 0,
  "endSeconds": 0,
  "maxVideosPerRun": 100,
  "maxAudioMinutesPerRun": 600,
  "maxVideoSizeMb": 500,
  "maxDurationMinutes": 240,
  "videoTimeoutSecs": 600
}
```

# Actor output Schema

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

One row per video with the audio download link, duration, minutes billed and status, as JSON, CSV, Excel and more.

## `records` (type: `string`):

Key-value store records: the audio files and the run summary with any failures.

# 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://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-done-right/extract-audio-from-video").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://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"] }

# Run the Actor and wait for it to finish
run = client.actor("data-done-right/extract-audio-from-video").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://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
  ]
}' |
apify call data-done-right/extract-audio-from-video --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-done-right/extract-audio-from-video"
        }
    }
}
```

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/okPFVFDmWZ0Oeqb5a/builds/hrla5bNauoef8GWFi/openapi.json
