# Audio format converter MP3 WAV FLAC (`akash9078/audio-file-converter`)

Convert audio files between 10+ formats including messaging platform optimized formats. Supports Telegram (OGG), WhatsApp (AMR), Discord (OPUS), plus MP3, WAV, FLAC, AAC, M4A, 3GP, WebM. Perfect for voice messages, podcasts, and cross-platform audio compatibility.

- **URL**: https://beta-securitybyobscurity.apify.com/akash9078/audio-file-converter.md
- **Developed by:** [Akash Kumar Naik](https://beta-securitybyobscurity.apify.com/akash9078) (community)
- **Categories:** Automation, Developer tools, Other
- **Stats:** 25 total users, 18 monthly users, 83.9% runs succeeded, NaN bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$15.00 / 1,000 results

This Actor is paid per result. You are not charged for the Apify platform usage, but only a fixed price for dataset items the Actor outputs.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-result

# README

## 🎵 Audio File Converter - 10+ Formats & Messaging Platform Ready

**Convert any audio file to formats optimized for Telegram, WhatsApp, Discord, Apple devices, and web streaming with intelligent quality optimization.**

![Audio Converter](https://apify-image-uploads-prod.s3.amazonaws.com/gb9lNRPvT8iN8gBqF/audio-converter-hero.jpg)

### 🚀 Quick Start

```bash
## Convert an MP3 to Telegram-optimized OGG
apify run --input='{"file_url": "https://example.com/audio.mp3", "target_format": "ogg"}'

## Convert to WhatsApp voice note format
apify run --input='{"file_url": "https://example.com/audio.mp3", "target_format": "amr", "quality": "medium"}'
```

### 📋 Input Parameters

| Parameter | Type | Required | Description | Example |
|-----------|------|----------|-------------|---------|
| **file\_url** | string | ✅ | Direct URL to your audio file | `https://example.com/audio.mp3` |
| **target\_format** | string | ✅ | Output format optimized for your platform | `opus` (Discord) |
| **quality** | string | ❌ | Audio quality level | `high` |
| **sample\_rate** | integer | ❌ | Custom sample rate in Hz | `48000` |

### 🎯 Platform-Specific Formats

#### 📱 Messaging Platforms

- **OGG** - Telegram voice messages (optimized compression)
- **AMR** - WhatsApp voice notes (mono, tiny files)
- **OPUS** - Discord voice (WebRTC, real-time)
- **M4A** - iMessage/Apple ecosystem

#### 🌐 Web & Streaming

- **MP3** - Universal compatibility (web, mobile)
- **WebM** - Modern web audio (HTML5 streaming)
- **AAC** - High-quality mobile streaming

#### 🎧 Professional

- **WAV** - Uncompressed studio quality
- **FLAC** - Lossless compression (audiophile)

### 📊 Output Schema

```json
{
  "success": true,
  "original_filename": "audio.mp3",
  "output_filename": "audio.opus",
  "input_format": "mp3",
  "output_format": "opus",
  "file_size_mb": 1.23,
  "conversion_duration_seconds": 2.5,
  "download_url": "https://api.apify.com/v2/key-value-stores/xxx/records/audio.opus",
  "input_duration_seconds": 180.5,
  "quality_settings": {
    "quality_level": "high",
    "bitrate": "256k",
    "sample_rate": 48000,
    "channels": 2
  },
  "platform_info": {
    "primary_use": "Discord voice communication",
    "platforms": "Discord, WebRTC, modern browsers",
    "optimization": "Real-time voice/music"
  },
  "timestamp": "2024-01-15T10:30:00.000Z"
}
```

### 🎼 Supported Input Formats

All common audio formats including:

- **MP3, WAV, FLAC, M4A, AAC, OGG, OPUS, AMR, 3GP, WebM**
- **Voice recordings from mobile devices**
- **Podcast audio files**
- **Music tracks**

### 🎯 Quality Levels

| Quality | Bitrate | Use Case |
|---------|---------|----------|
| **Low** | 128 kbps | Fastest conversions, smallest files |
| **Medium** | 192 kbps | Balanced quality and size |
| **High** | 256 kbps | Excellent quality for most uses |
| **Lossless** | Original | Maximum fidelity, largest files |

### 💡 Usage Examples

#### For Content Creators

```json
{
  "file_url": "https://mypodcast.com/episode1.wav",
  "target_format": "mp3",
  "quality": "high"
}
```

#### For Mobile Voice Messages

```json
{
  "file_url": "https://recording.com/voice-note.m4a",
  "target_format": "amr",
  "quality": "low"
}
```

#### For Web Applications

```json
{
  "file_url": "https://audio.com/soundtrack.wav",
  "target_format": "webm",
  "quality": "medium",
  "sample_rate": 48000
}
```

### 🚀 API Usage

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_API_TOKEN')
run = client.actor('audio-converter').call({
    'file_url': 'https://example.com/audio.mp3',
    'target_format': 'opus',
    'quality': 'high'
})

## Download converted file
import requests
response = requests.get(run['defaultDataset']['items'][0]['download_url'])
```

### 🔄 Cross-Platform Compatibility

This Actor intelligently optimizes audio files for:

- **Social Media**: Instagram, TikTok, Twitter
- **Messaging**: WhatsApp, Telegram, Discord, iMessage
- **Streaming**: YouTube, Spotify, Podcast platforms
- **Mobile**: iOS, Android, feature phones
- **Web**: HTML5, progressive web apps

### ⚡ Performance Features

- **Smart caching** for frequently requested conversions
- **Parallel processing** for multiple formats
- **Automatic format detection**
- **Optimized bitrate selection** based on format and quality
- **Real-time progress tracking**

### 🚫 Limitations

- **Maximum file size**: 100MB per input file
- **Maximum duration**: 2 hours per file
- **Supported formats**: Audio files only
- **Processing time**: Typically 1-5 seconds per minute of audio

### 💰 Pricing

- **Free tier**: 100 conversions/month
- **Paid plans**: Starting at $0.001 per conversion
- **Enterprise**: Custom pricing for high-volume usage

### 🔧 Troubleshooting

**Error: "URL not accessible"**

- Ensure the URL is publicly accessible (no authentication required)
- Verify the file extension matches the actual format

**Error: "Format not supported"**

- Check our [supported formats list](https://docs.apify.com/actors/audio-converter#supported-formats)
- Try converting to a more common format first

**Need help?** [Contact support](mailto:support@apify.com) or check our [troubleshooting guide](https://docs.apify.com/actors/audio-converter#troubleshooting)

***

Built with ❤️ for the [Apify Platform](https://apify.com) | [Report an issue](https://github.com/apify/actor-audio-converter/issues)

# Actor input Schema

## `file_url` (type: `string`):

Direct URL to your audio file. Supports MP3, WAV, FLAC, M4A, AAC, and most common formats.

## `target_format` (type: `string`):

Choose the output format based on your intended use. Each format is optimized for specific platforms and use cases.

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

Select quality based on file size vs audio fidelity trade-off. Higher quality = larger file size.

## `sample_rate` (type: `integer`):

Optional: Override the default sample rate. Use 48000 for OPUS, 44100 for general audio, 16000 for voice messages.

## Actor input object example

```json
{
  "file_url": "https://example.com/audio.mp3",
  "target_format": "mp3",
  "quality": "medium",
  "sample_rate": 48000
}
```

# 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 = {
    "file_url": "https://download.samplelib.com/mp3/sample-3s.mp3",
    "target_format": "mp3",
    "quality": "medium"
};

// Run the Actor and wait for it to finish
const run = await client.actor("akash9078/audio-file-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 = {
    "file_url": "https://download.samplelib.com/mp3/sample-3s.mp3",
    "target_format": "mp3",
    "quality": "medium",
}

# Run the Actor and wait for it to finish
run = client.actor("akash9078/audio-file-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "file_url": "https://download.samplelib.com/mp3/sample-3s.mp3",
  "target_format": "mp3",
  "quality": "medium"
}' |
apify call akash9078/audio-file-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=akash9078/audio-file-converter",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Audio format converter MP3 WAV FLAC",
        "description": "Convert audio files between 10+ formats including messaging platform optimized formats. Supports Telegram (OGG), WhatsApp (AMR), Discord (OPUS), plus MP3, WAV, FLAC, AAC, M4A, 3GP, WebM. Perfect for voice messages, podcasts, and cross-platform audio compatibility.",
        "version": "0.0",
        "x-build-id": "RS4tEbdDkOoLAqCPg"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/akash9078~audio-file-converter/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-akash9078-audio-file-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/akash9078~audio-file-converter/runs": {
            "post": {
                "operationId": "runs-sync-akash9078-audio-file-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/akash9078~audio-file-converter/run-sync": {
            "post": {
                "operationId": "run-sync-akash9078-audio-file-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "file_url",
                    "target_format"
                ],
                "properties": {
                    "file_url": {
                        "title": "🎼 Audio File URL",
                        "pattern": "^https?://.*",
                        "type": "string",
                        "description": "Direct URL to your audio file. Supports MP3, WAV, FLAC, M4A, AAC, and most common formats."
                    },
                    "target_format": {
                        "title": "📱 Target Format",
                        "enum": [
                            "mp3",
                            "wav",
                            "flac",
                            "ogg",
                            "aac",
                            "m4a",
                            "opus",
                            "amr",
                            "3gp",
                            "webm"
                        ],
                        "type": "string",
                        "description": "Choose the output format based on your intended use. Each format is optimized for specific platforms and use cases.",
                        "default": "mp3"
                    },
                    "quality": {
                        "title": "🔊 Audio Quality",
                        "enum": [
                            "low",
                            "medium",
                            "high",
                            "lossless"
                        ],
                        "type": "string",
                        "description": "Select quality based on file size vs audio fidelity trade-off. Higher quality = larger file size.",
                        "default": "medium"
                    },
                    "sample_rate": {
                        "title": "🎚️ Custom Sample Rate (Hz)",
                        "minimum": 8000,
                        "maximum": 192000,
                        "type": "integer",
                        "description": "Optional: Override the default sample rate. Use 48000 for OPUS, 44100 for general audio, 16000 for voice messages.",
                        "default": 44100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
