Linux – Command line tool to identify audio file specs

audiocommand linelinuxmacosmp3

I'm looking for an audio file equivalent to ImageMagick's identify command.

For example, with identify, I can get brief information about a bunch of images:

% identify b*
banner1.jpg JPEG 134x614 134x614+0+0 8-bit DirectClass 38.4kb 
banner.jpg[1] JPEG 772x307 772x307+0+0 8-bit DirectClass 37.5kb 
bg2.jpg[2] JPEG 103x1500 103x1500+0+0 8-bit DirectClass 43kb 
bg_control_nav.png[3] PNG 13x39 13x39+0+0 8-bit DirectClass 1.73kb 
bg_direction_nav.png[4] PNG 104x52 104x52+0+0 8-bit DirectClass 3.3kb 

I would like to get similar information about my audio files.

My eventual goal is to create a script to go through my whole mp3 library and identify those ripped at lower bitrates and then use that data to re-rip my CDs (or purchase better quality versions from Amazon or iTunes).

Solutions for OS X/Linux preferred to Windows solutions

Best Answer

On OS X you might just use mdls or mdfind.

$ mdls 01\ Kindred.mp3 
kMDItemAlbum                   = "Kindred EP"
kMDItemAudioBitRate            = 320000
kMDItemAudioChannelCount       = 2
kMDItemAudioSampleRate         = 44100
kMDItemAudioTrackNumber        = 1
kMDItemAuthors                 = (
    Burial
)
kMDItemComment                 = "HDB059"
kMDItemContentCreationDate     = 2012-03-19 21:20:59 +0000
kMDItemContentModificationDate = 2012-06-04 16:07:09 +0000
kMDItemContentType             = "public.mp3"
kMDItemContentTypeTree         = (
    "public.mp3",
    "public.audio",
    "public.audiovisual-content",
    "public.data",
    "public.item",
    "public.content"
)
kMDItemDateAdded               = 2012-04-02 19:49:07 +0000
kMDItemDisplayName             = "01 Kindred.mp3"
kMDItemDurationSeconds         = 686.08
kMDItemFSContentChangeDate     = 2012-06-04 16:07:09 +0000
kMDItemFSCreationDate          = 2012-03-19 21:20:59 +0000
kMDItemFSCreatorCode           = ""
kMDItemFSFinderFlags           = 0
kMDItemFSHasCustomIcon         = 0
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 0
kMDItemFSIsStationery          = 0
kMDItemFSLabel                 = 0
kMDItemFSName                  = "01 Kindred.mp3"
kMDItemFSNodeCount             = 27457838
kMDItemFSOwnerGroupID          = 20
kMDItemFSOwnerUserID           = 501
kMDItemFSSize                  = 27457838
kMDItemFSTypeCode              = ""
kMDItemKind                    = "MP3 audio"
kMDItemLogicalSize             = 27457838
kMDItemMediaTypes              = (
    Sound
)
kMDItemMusicalGenre            = "Dubstep"
kMDItemPhysicalSize            = 27459584
kMDItemRecordingYear           = 2012
kMDItemTitle                   = "Kindred"
kMDItemTotalBitRate            = 320000

mdfind -onlyin ~/Music 'kMDItemFSName==*.mp3&&kMDItemAudioBitRate<=192000'

Related Question