Hello all,

I would like to write a shell script that can scan a directory containing audio files and extract metadata or audio encoding information from the files.

The goal is for the shell script to be able to process music files based on embedded data as: Format, Data Rate, Duration, Annotations (Artist, Title, etc.)

Does anyone know of any (open source) unix command line software that can read audio files and provide this type of information?

Note: I am aware of some unix software that can do this, however I do not have access to X Windows on my ISP's server and I am looking for something that specifically runs via the command line.

Many thanks,
Dave

OS: FreeBSD

if you have Perl, you can use the MP3::Tag module.
eg

use MP3::Tag;
# set filename of MP3 track
my $filename = "test.mp3";
# create new MP3-Tag object
my $mp3 = MP3::Tag->new($filename);
# get tag information
my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
print "$title, $track, $artist, $album, $comment, $year, $genre\n";

it is able to update tag info as well. Read its documentation for how to edit the tags.

Thanks for the reply ghostdog74.

I didn't know about the MP3::Tag module and will definitely give it a try. It sounds like that would probably work for most of what I'd like to do.

However, I'm still interested in the ability to process audio files in formats other than MP3 as well as the ability to determine audio format, encoding, and any other data that describes the sound and quality of the audio -- not just the metadata.

For example:
- determine whether an audio file is stereo or mono
- determine duration (in seconds) of the song
- determine data rate of the file (e.g. 160 kbits/s)
- etc.

I welcome any suggestions for how to access this type of information via a shell script or via the command line.

Thanks,
Dave

This article has been dead for over six months. Start a new discussion instead.