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.

   -u --userprop } 4-cc
       Find and print a property or user data property (as hex string) [does not print to xml].

   -c --chunkdata } 4-cc
       Find and print a chunk (as hex string) [does not print to xml].

   -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 macOS commands

Local man page: afinfo - Command line help page on your local machine.
afconvert - Audio File Convert.
afplay - Audio File Play.


 
Copyright © 1999-2024 SS64.com
Some rights reserved