On this page
DocsGuides
Extract audio
Take the sound out of a video, or convert audio to MP3, AAC, Opus, FLAC or WAV.
POST /v1/audio writes the sound alone: from a video, or from another audio file.
The request#
curl "$VIDEXO_API_URL/v1/audio" \
-H "Authorization: Bearer $VIDEXO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "https://example.com/talk.mp4",
"filename": "talk.mp3",
"audio": {
"bitrate": "192k"
}
}'Copy failed. The text is selected; copy it with your keyboard.
const response = await fetch(`${process.env.VIDEXO_API_URL}/v1/audio`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VIDEXO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": "https://example.com/talk.mp4",
"filename": "talk.mp3",
"audio": {
"bitrate": "192k"
}
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
ffmpeg \
-i https://example.com/talk.mp4 \
-vn \
-map 0:a:0 \
-c:a libmp3lame -b:a 192k \
talk.mp3Copy failed. The text is selected; copy it with your keyboard.
talk.mp3: the soundtrack as a 192 kbit/s MP3.
Other formats#
format picks the file and its codec: mp3, m4a, aac, wav, flac, ogg or opus.
trim cuts a part.
curl "$VIDEXO_API_URL/v1/audio" \
-H "Authorization: Bearer $VIDEXO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "https://example.com/talk.mp4",
"format": "flac",
"trim": {
"start": 60,
"end": 120
}
}'Copy failed. The text is selected; copy it with your keyboard.
const response = await fetch(`${process.env.VIDEXO_API_URL}/v1/audio`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VIDEXO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": "https://example.com/talk.mp4",
"format": "flac",
"trim": {
"start": 60,
"end": 120
}
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
ffmpeg \
-ss 60 -t 60 -i https://example.com/talk.mp4 \
-vn \
-map 0:a:0 \
-c:a flac \
audio.flacCopy failed. The text is selected; copy it with your keyboard.
audio.channels: 1 makes it mono and audio.sample_rate resamples it, for speech recognition
that wants 16 kHz mono:
curl "$VIDEXO_API_URL/v1/audio" \
-H "Authorization: Bearer $VIDEXO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "https://example.com/talk.mp4",
"format": "wav",
"audio": {
"channels": 1,
"sample_rate": 16000
}
}'Copy failed. The text is selected; copy it with your keyboard.
const response = await fetch(`${process.env.VIDEXO_API_URL}/v1/audio`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VIDEXO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": "https://example.com/talk.mp4",
"format": "wav",
"audio": {
"channels": 1,
"sample_rate": 16000
}
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
ffmpeg \
-i https://example.com/talk.mp4 \
-vn \
-map 0:a:0 \
-c:a pcm_s16le -ar 16000 -ac 1 \
audio.wavCopy failed. The text is selected; copy it with your keyboard.