afinfo

Audio File Info.

Syntax
      afinfo [option...] audio_file(s)

Options: (may appear before or after arguments)
   -h
   --help
        print help
   -b
   --brief
        Print a brief (one line) description of the audio file
   -r
   --real
        Get the estimated duration after obtaining the real packet count
   --leaks
        Run leaks at the end of the conversion
   -i --info }
       print contents of the InfoDictionary
   -x
   --xml
       Print output in xml format
   --warnings
       Print warnings if any (by default warnings are not printed in non-xml output mode)

The macOS Finder Get Info window for an audio file displays: Genre, Author, Year Recorded, Sample Rate, Duration and Channels, where available.

Examples

Get file information for jolene.mp3:

$ afinfo jolene.mp3
File:           jolene.mp3
File type ID:   MPG3
Num Tracks:     1
----
Data format:     2 ch,  44100 Hz, '.mp3' (0x00000000) 0 bits/channel, 0 bytes/packet, 1152 frames/packet, 0 bytes/frame
                no channel layout.
estimated duration: 219.742025 sec
audio bytes: 8789681
audio packets: 8412
bit rate: 320000 bits per second
packet size upper bound: 1052
maximum packet size: 1045
audio data file offset: 33
optimized
----

Pipe the output to grep or awk to return individual values:
$ afinfo jolene.mp3 |grep 'bit rate'
bit rate: 320000 bits per second

“You've achieved success in your field when you don't know whether what you're doing is work or play” ~ Warren Beatty

Related:

afinfo man page - Apple.com
afconvert - Audio File Convert
afplay - Audio File Play


Copyright © SS64.com 1999-2017
Some rights reserved