Linux: How to view bit-rate and compress MP3 files

Posted on Fri 08 April 2022 in Linux

بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ

The following guide assumes the reader is comfortable with using a terminal editor (otherwise known as the command-line or command-prompt).

Two command-line tools are also required:

  • exiftool
  • lame

Depending on your Linux distribution, they should already be installed or available via the package manager.

Viewing the bit-rate

Viewing the bit-rate of an MP3 file helps to determine whether the file should be compressed and what the current quality of the audio is.

To view the bit-rate, navigate to the folder where the MP3 file is stored via the command-line.

Enter the following command:

exiftool -AudioBitrate myfilename.mp3

The expected output should be:

Audio Bitrate : 128 kbps

Compressing the MP3 file

According to this source, the lowest acceptable quality bit-rate for MP3 files is "32 kbit/s".

After choosing your preferred bit-rate, run the following command:

lame -b 64 myfilename.mp3 myfilename-64.mp3

The compression may take some time depending on the size of the file. once completed, a new file should exist called myfilename-64.mp3 and the file size should be smaller than the original.


If you don't know how to use RSS and want email updates on my new content, consider Joining my Newsletter

The original content of this blog is a Waqf solely for the Pleasure of Allah. You are hereby granted full permission to copy, download, distribute, publish and share this content without modification under condition that full attribution is given to this author by creating a link either above or below the content that links back to the original source of the content. For any questions or ambiguity, you are requested to contact me via email for clarification.