Extract Audio from M3U8 Streams with FFmpeg
Learn how to extract audio from M3U8/HLS streams. Save as MP3, AAC, FLAC, or other audio formats using FFmpeg.
Basic Audio Extraction
To extract audio from an M3U8 stream and save as MP3:
ffmpeg -i "https://example.com/stream.m3u8" -vn -c:a libmp3lame -q:a 2 audio.mp3
The -vn flag tells FFmpeg to ignore video streams. The audio is encoded as MP3 with VBR quality level 2 (on a scale of 0-9, where 0 is best).
Extracting to Different Audio Formats
AAC (good quality, small size):
ffmpeg -i "stream.m3u8" -vn -c:a aac -b:a 192k audio.m4a
FLAC (lossless, large size):
ffmpeg -i "stream.m3u8" -vn -c:a flac audio.flac
WAV (uncompressed, huge size):
ffmpeg -i "stream.m3u8" -vn -c:a pcm_s16le audio.wav
Opus (best modern codec):
ffmpeg -i "stream.m3u8" -vn -c:a libopus -b:a 96k audio.opus
Extracting Without Re-encoding
If the stream uses a compatible audio codec (AAC), you can extract without quality loss:
ffmpeg -i "stream.m3u8" -vn -c:a copy audio.aac
Selecting a Specific Audio Track
Some streams have multiple audio tracks (different languages). Select one:
# List available streams
ffmpeg -i "stream.m3u8"
# Select audio track 0
ffmpeg -i "stream.m3u8" -map 0:a:0 -c:a copy audio.aac
Related Articles
Convert M3U8 to MP4 with FFmpeg: Complete Guide
Step-by-step guide to converting M3U8 streams to MP4 using FFmpeg. Fast, lossless, and fully customizable conversion commands.
FFmpeg M3U8 Commands You Need to Know
Essential FFmpeg commands for working with M3U8/HLS streams. Quick reference for downloading, converting, and analyzing streams.