Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

4 Answers 4

up vote 7 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 at 4:44
add comment

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
add comment

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

sudo apt-get install mediainfo

Example:

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

Output:

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
add comment

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
add comment

Your Answer

 
discard

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.