Docs · Extract audio as MP3
Guides · Extract audio as MP3

Extract audio as MP3

Drop the video with -vn and encode the audio with libmp3lame. The response holds the MP3’s download URL.

The request

Request
curl https://media.logicboostkit.com/ffmpeg/process \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": {
      "inputs": [
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/source.mp4"
        }
      ],
      "outputs": [
        {
          "file": "audio.mp3",
          "options": [
            "-vn",
            "-c:a",
            "libmp3lame",
            "-q:a",
            "2"
          ]
        }
      ]
    }
  }'
Response
HTTP/1.1 200 OK
X-Request-Id: job_0mv6ihz6vfx5ua0h05x8bmql

{
  "ok": true,
  "result": [
    {
      "file_name": "audio.mp3",
      "size_bytes": 12582912,
      "download_url": "https://…"
    }
  ],
  "usage": {
    "time_sec": 7,
    "input_size_gb": 0.4,
    "output_size_gb": 0.01171875,
    "gb_sec": 2.882031253
  },
  "request_id": "job_0mv6ihz6vfx5ua0h05x8bmql",
  "amount_usd": 0.038388656
}

The input is a file you uploaded (POST /file). The full reference is POST /ffmpeg/process.

The options, explained

What each option does
-vnNo video in the output.
-c:a libmp3lameEncode the audio as MP3.
-q:a 2Variable bitrate, high quality: about 190 kbit/s. 0 is the best and largest, 9 the smallest.

Variations

A fixed bitrate

For players that expect one.

In the output: "options": ["-vn", "-c:a", "libmp3lame", "-b:a", "192k"]

Keep the original audio

Copy the AAC track as it is, without re-encoding.

In the output: "file": "audio.m4a", "options": ["-vn", "-c:a", "copy"]

WAV for editing

Uncompressed audio.

In the output: "file": "audio.wav", "options": ["-vn", "-c:a", "pcm_s16le"]

What it costs

The audio of a 0.4 GB video, as a 12 MB MP3 in 7 seconds: (0.4 GB + 0.012 GB) × 7 s = 2.884 GB-seconds, which is USD 0.0384 at USD 0.01332 per GB-second.

The seconds are an example; every response reports the job’s own. Failed jobs are not charged. See Pricing.