YouTube to MP3 API: Extract Audio as MP3, M4A, FLAC or WAV
The request
{
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"audio_only": true,
"audio_format": "mp3"
}
If you set audio_only without a format, you get MP3. The finished job reports "type": "audio" along with the link and size. audio_format is only accepted together with audio_only, and the API returns a 400 error if you send it on a video request.
Which format to choose
| Format | What you get | Best for |
|---|---|---|
original | YouTube's own audio stream, usually Opus or AAC, with no re-encoding | Transcription, archives, anything where quality matters |
m4a | AAC in an M4A file | Apple devices, podcasts, small files |
opus | Opus, the codec YouTube uses for most of its best audio | Small files at good quality, web playback |
mp3 | MP3 | Plays everywhere. The safe default |
wav | Uncompressed PCM | Editing software that prefers WAV |
flac | Lossless compression of the decoded audio | Workflows that require FLAC |
One thing to know: YouTube only stores compressed audio. Converting it to WAV or FLAC preserves exactly what YouTube had, but can't restore what compression removed, and the files are several times larger. If you don't need a specific format, original gives the best quality at the smallest size.
For transcription and AI pipelines
Speech-to-text models such as Whisper accept MP3, M4A, Opus and WAV. Audio is a fraction of the size of the video, so it's faster to download, cheaper to store, and quicker to upload to a transcription service. If the video already has captions, you may not need audio at all: request the subtitles instead, as shown in downloading YouTube subtitles by API.
Steadier volume with voice_boost
Some YouTube videos carry an extra audio track that YouTube processes for stable volume, so quiet speech and loud music sit closer together. Send "voice_boost": true to prefer that track when a video has one. It helps with talks, interviews and podcasts recorded at uneven levels.
The same thing with yt-dlp
yt-dlp -x --audio-format mp3 --audio-quality 0 "https://www.youtube.com/watch?v=VIDEO_ID"
yt-dlp -f "ba" "https://www.youtube.com/watch?v=VIDEO_ID"
The first converts to the best-quality MP3 and needs ffmpeg. The second downloads the best original audio stream without converting it. At scale, the usual yt-dlp problems apply: bot checks and blocks on servers, covered in 403, 429 and IP bans.
Limits that apply to audio
- Each audio file counts as one video toward your monthly quota.
max_audio_size_gbandmax_duration_minutescan cap a request. They can't go above your plan's limits.audio_onlyandvideo_onlycan't be combined.
FAQ
Is there an API to convert YouTube videos to MP3?
Yes. With the VideoDL API, send the video URL with "audio_only": true and "audio_format": "mp3". The finished job returns a link to the MP3 file.
What's the best audio format for transcribing YouTube videos?
The original stream (usually Opus or AAC) or MP3. Speech-to-text tools accept both, and they're far smaller than WAV. Converting to WAV or FLAC doesn't improve transcription.
Does converting YouTube audio to FLAC improve quality?
No. YouTube only stores compressed audio, so FLAC or WAV keeps exactly what YouTube had but can't restore detail. The files just get larger.
How do I download only the audio with yt-dlp?
Use yt-dlp -x --audio-format mp3 URL to convert to MP3, or yt-dlp -f ba URL to save the best original audio stream without converting it.
What does voice_boost do?
It prefers YouTube's stable-volume audio track when a video has one, which evens out quiet speech and loud sections. It's useful for talks and interviews.
Audio from YouTube, by API
MP3, M4A, Opus, FLAC, WAV or the original stream, delivered as a link or to your cloud. From $12/month.
Keep reading
All articles →
Download YouTube subtitles as SRT or VTT
Get YouTube captions as SRT, VTT or ASS files in up to 5 languages per request, with or without the video. The API fields, yt-dlp commands and common gotchas.
YouTube download API for AI agents
AI agents running yt-dlp hit "Sign in to confirm you're not a bot" on cloud servers. Give your agent a download API instead: one call in, a file link out.
Build a YouTube dataset for AI training
How to collect, structure and version a YouTube dataset for AI training: folder layout, manifest fields, channel-level splits, captions and a sample manifest.