How to find the bitrate of an mp3 file via command line?

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

Get exactly the audio bitrate via mediainfo in bps:

mediainfo --Output='Audio;%BitRate%' '/MY/MEDIA/FILE.MP3'

or in Kbps:

mediainfo --Output='Audio;%BitRate/String%' '/MY/MEDIA/FILE.MP3'

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

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