How to Extract Audio from Video in Node.js
Extract MP3 audio from MP4 video files using the Convert Fleet API in Node.js. Perfect for podcast tools, transcription, and media automation pipelines.
You need an API key to follow this guide. Get a free API key →
1Install Dependencies
Install axios and form-data for HTTP requests.
npm install axios form-data2Extract MP3 Audio from MP4
Use the Convert Fleet API to extract the audio track from any MP4 video file.
const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');
async function extractAudio(videoPath, outputMp3Path) {
const form = new FormData();
form.append('file', fs.createReadStream(videoPath));
form.append('to', 'mp3');
const response = await axios.post(
'https://convertfleet.com/api/convert',
form,
{
headers: {
...form.getHeaders(),
'Authorization': 'Bearer YOUR_API_KEY',
},
responseType: 'arraybuffer',
}
);
fs.writeFileSync(outputMp3Path, response.data);
console.log(`Audio extracted to: ${outputMp3Path}`);
}
extractAudio('./video.mp4', './audio.mp3');That's it!
You've successfully integrated the Convert Fleet API. Check the API reference for the full list of parameters and error codes.
Related API Endpoints
More Integration Guides
Start Building Today
Free tier includes 200 free credits (valid 30 days from signup). Pro plan unlocks unlimited API access.