Skip to content

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#

bash
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"
  }
}'

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.

bash
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
  }
}'

audio.channels: 1 makes it mono and audio.sample_rate resamples it, for speech recognition that wants 16 kHz mono:

bash
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
  }
}'