943,917 Members | Top Members by Rank

Ad:
Apr 12th, 2009
0

Extract metadata from audio files via command line?

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
metaface is offline Offline
11 posts
since Jan 2006
Apr 15th, 2009
0

Re: Extract metadata from audio files via command line?

if you have Perl, you can use the MP3::Tag module.
eg
Shell Scripting Syntax (Toggle Plain Text)
  1. use MP3::Tag;
  2. # set filename of MP3 track
  3. my $filename = "test.mp3";
  4. # create new MP3-Tag object
  5. my $mp3 = MP3::Tag->new($filename);
  6. # get tag information
  7. my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
  8. 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.
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006
Apr 15th, 2009
0

Re: Extract metadata from audio files via command line?

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
Last edited by metaface; Apr 15th, 2009 at 3:34 am.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
metaface is offline Offline
11 posts
since Jan 2006
Apr 15th, 2009
0

Re: Extract metadata from audio files via command line?

you may search the CPAN library for Audio::Taglib. ( there are others, so pls do a search).
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Line addressing with sed using a variable
Next Thread in Shell Scripting Forum Timeline: problem with input redirection in MS-DOS





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC