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



Question:

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?


Solution:1

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  


Solution:2

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


Solution:3

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  


Solution:4

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  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »