How to Check Bitrate of MP3, m4a, & Audio Files from Command Line of Mac OS X

Oct 4, 2010 - 5 Comments

Mac audio

Mac users can quickly get the bitrate of any MP3, m4a, or other audio file from the command line of OS X.

To get started, launch Terminal (from /Applications/Utilities/ or via Spotlight) and then type the following command pointed at a filename to query the bit rate for that audio file:

afinfo filename |grep "bit rate"

The command will report back something like:

bit rate: 320000 bits per second

The bit rate is reported in bits per second but in full notation, so 320000 is the same as 320kbps, 192000 is the same as 192kbps, and so forth.

For example, using this on a file named “thunderstorms.m4a” could look something like the following:

$ afinfo /Users/Paul/Downloads/thunderstorms.m4a | grep "bit rate"
bit rate: 192000 bits per second

In this example, the m4a audio file bitrate is 192kpbs.

The afinfo command is included in Mac OS X and without the attached grep command will report back extended information on audio files as detailed here. It can be a really great utility for many users, particularly audio enthusiasts and audio engineers.

If you don’t like working in the command line, you can also get this information from iTunes by using the built-in Get Info function, which is available in Mac OS X and Windows versions of iTunes, but of course, iTunes is not accessible from the command line in the same manner.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: David Mendez in Command Line, Mac OS X, Tips & Tricks


» Comments RSS Feed

  1. Dinoo says:

    You can also do this in iTunes

  2. kc_cramer says:

    Isn’t this information also available in the Get Info window for any selected audio file?

    NOTE: It’s in the More Info section (in Snow Leopard, at least, I don’t know how far back this capability goes).

  3. Alberto says:

    Select the file and press command I 😀

  4. Jeroen says:

    If you want to use a terminal command (e.g. for scripting or integrating with an AppleScript), the command “file” is quicker, more compact and even gives file info on all kinds of other non-audio formats:

    $ file “01 – Buffalo Stance.mp3”

    01 – Buffalo Stance.mp3: MPEG ADTS, layer III, v1, 256 kbps, 44.1 kHz, Stereo

  5. jags says:

    jesus terminal

Leave a Reply


Shop for Apple & Mac Deals on

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates