If you’re converting more than a few audio files, using graphical tools (including online tools or apps) can be a laborious process. The instructions below show you how to bulk convert audio files from the Linux terminal, saving you time.

First, Make Sure You Have FFmpeg

FFmpegis a free command-line tool for processing media files. you may use it to bulk convert audio files to change their format, reduce their size, or make their volume consistent. It’s available in most Linux distributions' software repositories, and can be installed on Debian/Ubuntu systems using the following command:

You can alsouse FFmpeg to convert audio files on Windows.

It’s important that you understand any terminal commands you copy/paste from the internet before you run them. Brief explanations are included below, but verify you check what each command does before you run it!

Convert Audio File Format

The Linux terminal command below shows how to use FFmpeg toconvert a WAV file to MP3:

To quickly explain what’s going on here (and in the other examples on this page that use loops to process multiple files):

Popular audio file formats supported by FFmpeg for audio conversion are MP3, AAC,OGG, WAV, FLAC,M4A, WMA, and AIFF.

To change the file conversion in the above script, replace.wavwith the file extension matching the files you want to convert the format of, and replace .mp3with a FFmpeg supported format to convert to. Keep in mind that file paths and extensions in Linux are case-sensitive!

Change Audio Bitrate

The below terminal command bulk converts the bitrate of MP3 files to 128k:

Lowering the bitrate makes audio files smaller, while raising it makes them larger. Note that reducing the bitrate is a one-way process: once you’ve reduced the quality, the information lost cannot be retrieved, and raising the bitrate again will not restore the original quality (though the file may still get bigger, the quality won’t be improved).

Common bitrates used in digital audio are:

Bitrates under 128k will really make your audio suffer (and sound like an old phone call), so are only recommended for situations where compressing lots of audio (such as long recordings of conversations) is necessary.

Normalize Audio Volume

Volume normalization makes the audio level of an audio file consistent so that the loud parts of a file aren’t significantly louder than the rest of the recording:

Theloudnormfilter in FFmpeg is used in the above terminal command to normalize volume.

Convert to Mono/Stereo

One way to further reduce the size of an audio file is to convert it from stereo to mono (provided the content doesn’t need to be in stereo, for example call recordings):

Note that, like reducing bitrate, you lose information when converting stereo to mono. The left and right tracks will be merged and won’t be un-merged if you convert the file back to stereo; the mono track will just be duplicated to the right/left channels.

Batch Rename Files

The command below appends the string_renamedto the filename of all MP3 files in a directory:

If you’re regularly bulk converting or renaming audio files in Linux, you canadd these commands to a Bash scriptfor convenient re-use.

Linux Is a Great Platform for Audio Editing

If you’re looking to go beyond simple bulk audio conversion, you canlearn how to make your own musicin Linux orhost your own streaming radio server.