Convert audio files between formats (MP3, WAV, OGG, FLAC, M4A, AAC, OPUS) and adjust properties such as bit rate, sample rate, and channel count using ffmpeg. Use this skill whenever the user wants to change an audio file's format, compress it, or re-encode it.
Convert audio files between formats and adjust encoding parameters with ffmpeg.
Input and output: MP3, WAV, OGG, FLAC, M4A (AAC), AAC, OPUS, WMA, AIFF, and all other formats supported by ffmpeg.
ffmpeg -i input.wav -acodec libmp3lame -ab 192k output.mp3
ffmpeg -i input.mp3 output.wav
ffmpeg -i input.mp3 output.flac
ffmpeg -i input.mp3 -acodec libvorbis -q:a 5 output.ogg
ffmpeg -i input.wav -acodec libopus -b:a 96k output.opus
ffmpeg -i input.mp3 -acodec aac -ab 192k output.m4a
ffmpeg -i input.wav -ar 16000 output.wav
ffmpeg -i input.wav -ac 1 output.wav
ffmpeg -i input.wav -ab 128k output.mp3
ffmpeg -i input.mp3 -ar 16000 -ac 1 -acodec pcm_s16le output.wav
for f in *.mp3; do ffmpeg -i "$f" "${f%.mp3}.wav"; done
ffprobe -v quiet -show_streams -select_streams a:0 input.mp3
| Format | Codec flag | Notes |
|---|---|---|
| MP3 | libmp3lame | Requires lame in ffmpeg build |
| AAC/M4A | aac | Built-in encoder |
| OGG | libvorbis | Open, patent-free |
| OPUS | libopus | Best quality/size ratio |
| FLAC | flac | Lossless, larger files |
| WAV | pcm_s16le | Uncompressed PCM |
-n to skip existing files or -y to always overwrite.-map_metadata -1.