FFmpeg Recipe

Convert video files into MP3 or audio-only outputs

Extract audio from video with a single API call. Perfect for podcast pipelines, transcription prep, and AI audio processing.

Why extract audio?

Audio extraction is a common first step in many media workflows:

  • Podcast production — Pull audio from video recordings for podcast episodes
  • Transcription pipelines — Feed audio-only files to speech-to-text services like Whisper or Deepgram
  • AI input preprocessing — Reduce file size and processing overhead by removing video streams
  • Music extraction — Isolate soundtracks or audio tracks from video content

The raw FFmpeg command

To extract audio from a video file using FFmpeg on the command line:

ffmpeg -i input.mp4 -vn -acodec libmp3lame -q:a 2 output.mp3

Where:

  • -vn — Disable video (audio only)
  • -acodec libmp3lame — Use MP3 encoder
  • -q:a 2 — Audio quality (0-9, lower is better)

The API version

With the FFmpeg Micro API, you can extract audio without installing FFmpeg or managing servers:

curl -X POST https://api.ffmpeg-micro.com/v1/transform \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_url": "https://example.com/video.mp4",
    "output_format": "mp3",
    "ffmpeg_args": ["-vn", "-acodec", "libmp3lame", "-q:a", "2"]
  }'

Get your API key from the dashboard. See the quickstart guide for setup steps.

Supported output formats

FFmpeg Micro supports all common audio formats:

FormatCodecUse Case
MP3libmp3lameUniversal compatibility, podcasts
AACaacHigh quality, smaller files
WAVpcm_s16leLossless, audio editing
OGGlibvorbisOpen format, streaming
FLACflacLossless compression

Bitrate and codec notes

Control audio quality with bitrate or quality settings:

# Variable bitrate (recommended for MP3)
"ffmpeg_args": ["-vn", "-acodec", "libmp3lame", "-q:a", "2"]

# Constant bitrate (192 kbps)
"ffmpeg_args": ["-vn", "-acodec", "libmp3lame", "-b:a", "192k"]

# AAC high quality
"ffmpeg_args": ["-vn", "-acodec", "aac", "-b:a", "256k"]

For MP3, quality levels (-q:a):

  • 0 — Best quality (245 kbps)
  • 2 — High quality (190 kbps, recommended)
  • 4 — Medium quality (165 kbps)
  • 6 — Low quality (115 kbps)

Example request and response

Full API request example:

POST /v1/transform
Content-Type: application/json
Authorization: Bearer ffm_live_abc123...

{
  "input_url": "https://cdn.example.com/recording.mp4",
  "output_format": "mp3",
  "ffmpeg_args": ["-vn", "-acodec", "libmp3lame", "-q:a", "2"],
  "webhook_url": "https://example.com/webhooks/audio-ready"
}

Response:

{
  "id": "tfm_abc123",
  "status": "processing",
  "input_url": "https://cdn.example.com/recording.mp4",
  "output_format": "mp3",
  "created_at": "2024-01-15T10:30:00Z"
}

Poll the status endpoint or wait for the webhook to get the output URL:

GET /v1/transform/tfm_abc123

{
  "id": "tfm_abc123",
  "status": "completed",
  "output_url": "https://cdn.ffmpeg-micro.com/outputs/audio.mp3",
  "completed_at": "2024-01-15T10:30:42Z"
}

Use cases

Podcast extraction

Record Zoom or Riverside sessions as video, then extract high-quality audio for podcast distribution. The API handles the conversion automatically without local FFmpeg installation.

Transcription pipeline

Before sending files to Whisper, Deepgram, or AssemblyAI for transcription, extract audio to reduce file size and speed up processing. Audio-only files are faster to upload and cheaper to transcribe.

See the Python integration guide for a complete transcription pipeline example.

AI input preprocessing

Many AI models accept audio input for tasks like speaker identification, sentiment analysis, or music classification. Extracting audio first reduces bandwidth and processing time compared to sending full video files.

Related recipes

Ready to extract audio?

Start with 100 free minutes of video processing. No FFmpeg installation required.