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

Oct 4, 2010 - 10 Comments

Mac audio

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

How to Get Bitrate of Audio Files on Mac from Command Line

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.


Related articles:

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


» Comments RSS Feed

  1. Adam Oved says:

    Much easier to open the file in Quicktime or iTunes
    and just press CMD+I

  2. fernando says:

    back to fn 1991 DOS. On top of all this, OP has the balls to say “users can quickly get”

  3. Piotr says:

    Why make easy things difficult? So much hype behind Apple but precious little substance to support this. 100 worse than good old Windows

  4. ferdi says:

    What the junk is that ? This is basic info, not even available from the “more info” menu.. So we’d have to run the Terminal just to know if we’re in 320 or 192 kb/s ?

    :/ f*ck you apple, still downgrading

  5. Steve says:

    Get Info in Finder doesn’t give this info in El Capitan.
    “More Info” shows the sample rate but not the bit rate.
    Why on Earth?!?!?!?

  6. jags says:

    jesus terminal

  7. 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

  8. Alberto says:

    Select the file and press command I :D

  9. 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).

  10. Dinoo says:

    You can also do this in iTunes

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

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

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site