WAV to MP3
ffmpeg -i input.wav output.mp3FFmpeg chooses a suitable MP3 encoder and default settings from the build you installed.
FFmpeg can convert, inspect, extract, filter and automate media files. The command line looks harder than it is. Most everyday jobs follow the same pattern: input → options → output.
Open PowerShell, Command Prompt, Terminal, or your shell of choice and run:
ffmpeg -version
If you see version and build information, you are ready. If the shell says FFmpeg is not recognized or not found, install it and make sure the FFmpeg executable is available on your PATH.
For simple conversions, the output extension often does most of the work.
ffmpeg -i input.wav output.mp3FFmpeg chooses a suitable MP3 encoder and default settings from the build you installed.
ffmpeg -i input.wav output.flacFLAC is lossless. The decoded audio remains the same while the file is compressed.
ffmpeg -i music.flac music.wavUseful when an editor, game tool or older program wants uncompressed PCM.
ffmpeg -i input.wav -c:a libopus -b:a 128k output.opusThis explicitly chooses the Opus encoder and a target audio bitrate.
The file extension chooses the container or format. -c:a chooses the audio encoder. Quality or bitrate options control the tradeoff between size and quality.
ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3With LAME, lower -q:a values mean higher VBR quality. A value around 2 is a common high-quality starting point.
ffmpeg -i input.wav -c:a libmp3lame -b:a 192k output.mp3Use a fixed bitrate when you need predictable size or hardware compatibility.
ffmpeg -i input.wav -c:a aac -b:a 192k output.m4aThe built-in AAC encoder is widely available in normal FFmpeg builds.
ffmpeg -i input.wav -c:a libopus -b:a 128k output.opusOpus is efficient at relatively low bitrates. Use a bitrate appropriate for music, speech, or game assets.
ffmpeg -i input.wav -c:a flac -compression_level 8 output.flacHigher FLAC compression generally trades more encoding work for a somewhat smaller file. It does not change decoded audio quality.
ffmpeg -i input.wav -ar 48000 -ac 2 output.wav-ar 48000 sets 48 kHz. -ac 2 requests two output channels.
If you do not need to change codec, sample rate, channels, loudness, or other audio content, do not re-encode just because you can. Lossy-to-lossy conversion can reduce quality.
FFmpeg itself processes one command at a time. Your shell supplies the loop. That makes batch work flexible, but it also means you are responsible for filenames, output folders, collisions and failures.
New-Item -ItemType Directory -Force mp3 | Out-Null
Get-ChildItem -Filter *.wav | ForEach-Object {
ffmpeg -i $_.FullName -c:a libmp3lame -q:a 2 (Join-Path "mp3" ($_.BaseName + ".mp3"))
}
mkdir -p mp3
for f in *.wav; do
ffmpeg -i "$f" -c:a libmp3lame -q:a 2 "mp3/${f%.*}.mp3"
done
Start on a copy of a small folder first. Once the command produces the filenames and quality you expect, use it on the larger library.
A video file can contain video, one or more audio streams, subtitles and metadata. You can either copy an existing audio stream or decode it and create a new audio file.
ffmpeg -i video.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3-vn means do not include video in the output.
ffmpeg -i video.mp4 -vn audio.wavFFmpeg decodes the selected audio stream and creates PCM audio in a WAV file.
ffmpeg -i video.mp4 -vn -c:a copy audio.m4aStream copy is fast and avoids generation loss, but the output container must support the audio codec that is already inside the video.
ffmpeg -i video.mkv -map 0:a:1 -vn audio.flacThis selects the second audio stream from input 0. Stream numbering starts at zero.
If a file has multiple audio tracks or you are unsure which codec it uses, inspect it before writing a complicated command.
ffmpeg -i video.mkv
FFmpeg prints the streams it finds. Look for lines labeled Audio, including codec, sample rate, channel layout and stream number. FFmpeg may end with a message about no output being specified. That is expected when you are only inspecting the input.
ffmpeg is not recognized / command not foundFFmpeg is either not installed or your shell cannot find it. Check ffmpeg -version. If necessary, run FFmpeg using its full path or add its executable directory to PATH.
The input path is wrong, you are in the wrong folder, or the filename needs quoting. Use quotes around paths that contain spaces:
ffmpeg -i "My Music/song one.wav" "output.mp3"FFmpeg normally asks before overwriting. Use -y only when you intentionally want to overwrite without being asked:
ffmpeg -y -i input.wav output.flacYour FFmpeg build does not contain the encoder named in the command, or the encoder name is wrong. Run ffmpeg -encoders and search the list. Different builds can include different optional libraries.
Often this is a bad option value, an output container that cannot hold the selected codec, or a malformed path. Read the lines immediately above the final error. FFmpeg usually reports the more specific cause there.
Check the input streams and any -map option. If the source has several audio tracks, make sure you selected the one you intended.
Check whether you converted from one lossy codec to another and review bitrate or quality settings. When possible, start from a lossless or original source.
The shell loop and FFmpeg are separate pieces. One bad file, naming collision, permissions problem, or script setting can interrupt a batch. Test small, keep source files untouched, and review the console output for the first failed file.
-i input-c:a audio codec-b:a audio bitrate-q:a encoder quality-ar sample rate-ac channel count-vn omit video-map select streams-y overwrite-n never overwriteFFmpeg is much larger than audio conversion. Its official manual documents stream selection, codecs, filters, mapping, metadata, hardware acceleration and hundreds of format-specific options.