Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the terminal command that can used to find the bitrate of an mp3 file?

Is there any other option available other than mpg321 -t name.mp3?

share|improve this question
up vote 17 down vote accepted

Simply put:

file song.mp3

Note: file is included with Ubuntu.

For alias lovers, insert this at the end of your ~/.bashrc file:

bitrate () {
    echo `basename "$1"`: `file "$1" | sed 's/.*, \(.*\)kbps.*/\1/' | tr -d " " ` kbps

Open a new Terminal window. You may now run the following command:

bitrate song.mp3
share|improve this answer
wow. Simple file command did the trick. – devav2 Oct 5 '12 at 19:32
Be warned: if the file is variable bit rate (VBR), file will report only the one of the many bit rates present. (I think it's the first frame's bit rate.) The answer could be deceptive if most of the file is at a very different rate. If you want to know the average bit rate, see apacheuk's answer. – Alan De Smet Feb 5 '14 at 4:44
+1 Any chance you could add a brief summary to this answer, explaining how it works? – tjt263 Dec 21 '15 at 22:40
For some reason file doesn't work with a whole lot of MP3s I have which are properly identified by exiftool and even better by mediainfo. – jamadagni Mar 27 at 10:10

Install mp3info package

sudo apt-get install mp3info

To find the bitrate use

mp3info -r a -p "%f %r\n" *.mp3 

will give the info you need, also has some other useful functions man mp3info for more info

share|improve this answer
mp3info does not support ID3v2 tagging. – Ian Sep 13 '13 at 17:15
@Ian: true as that may be, it's irrelevant to this question or this answer. – Johann Jun 24 '15 at 5:14
If you are curious about the bit rate alone, then yes -- it's irrelevant. If you found this answer because you were working on a script that needed the bitrate in addition to other fields from your mp3 files (some of which only have ID3v2 tags) then this information would prevent you from going down a dead end with mp3info -- a program that does not always extract info from mp3s. – Ian Jun 24 '15 at 12:31

MediaInfo is further solution to do that (not only on mp3).

sudo apt-get install mediainfo


mediainfo Aphrodite_-_Superman_\(dnb\).mp3 | grep "Bit rate"


Bit rate mode                            : Constant
Bit rate                                 : 192 Kbps

Another Example:

mediainfo Aphrodite_-_Superman_\(dnb\).mp3 | grep 'Bit rate  '

Another Output:

Bit rate                                 : 192 Kbps
share|improve this answer

You can install the package libimage-exiftool-perl:

sudo apt-get install libimage-exiftool-perl

Then run:

exiftool -AudioBitrate GoldLion.mp3

It will output something like:

Audio Bitrate : 192 kbps
share|improve this answer
Cool! This provides wonderful meta information about the file. – devav2 Oct 5 '12 at 19:30
Yes but it doesn't identify VBR. Buzz-Dee's answer below about MediaInfo helps with that. – jamadagni Mar 27 at 10:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.