MP4 API for Developers

Implement MP4.to converter API to convert any MP4 to: mp3, wav, m4a, flac, wma, aiff, aac, mp2, m4r, ogg, ima, ac3, amr, dts, opus, avi, wmv, mpeg, mov, mpg, divx, webm, mpeg-2, mjpeg, flv, 3gp, vob, av1, m4v

Or to convert any file to MP4.


* We are adding more functionalities. Please refer to our API documentation for more info


Get API key →
curl -POST 'https://mp4.to/v1/api' \
-F 'data=@/testing.mp4' \
-F 'data={"convert_to": "mp3"}' \
-H 'Authorization: <YOUR_API_KEY>' \
--output file.mp3
<?php
    $post_data = array(
        "data" => "{\"convert_to\": \"mp3\"}",
        "file_contents" => curl_file_create("file.mp4")
    );
    $fp = fopen("file.mp3", "w+");
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "https://mp4.to/v1/api");
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        "Authorization: <YOUR_API_KEY>"
    ));
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($curl, CURLOPT_FILE, $fp);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    $content = curl_exec($curl);
    curl_close($curl);
    fclose($fp);
?>
import requests
import json

url = 'https://mp4.to/v1/api'
files = {'file': open('testing.mp4', 'rb')}
params = {'convert_to': 'mp3'}
data = {'data': json.dumps(params)}
headers = {'Authorization': '<YOUR_API_KEY>'}

r = requests.post(
    url,
    files=files,
    data=data,
    headers=headers
)

with open('file.mp3', 'wb') as f:
    f.write(r.content)
const request = require('request');
const fs = require('fs');

let req = request.post({
    url: 'https://mp4.to/v1/api',
    headers: {
        'Authorization': '<YOUR_API_KEY>'
    },
    formData: {
        file: fs.createReadStream('file.mp4'),
        data: JSON.stringify({'convert_to': 'mp3'})
    }
});

req.on('response', function(response) {
    response.pipe(fs.createWriteStream('file.mp3'));
});