Extract metadata from audio files via command line?

Reply

Join Date: Jan 2006
Posts: 11
Reputation: metaface is an unknown quantity at this point 
Solved Threads: 1
metaface metaface is offline Offline
Newbie Poster

Extract metadata from audio files via command line?

 
0
  #1
Apr 12th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 148
Reputation: ghostdog74 is on a distinguished road 
Solved Threads: 40
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: Extract metadata from audio files via command line?

 
0
  #2
Apr 15th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 11
Reputation: metaface is an unknown quantity at this point 
Solved Threads: 1
metaface metaface is offline Offline
Newbie Poster

Re: Extract metadata from audio files via command line?

 
0
  #3
Apr 15th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 148
Reputation: ghostdog74 is on a distinguished road 
Solved Threads: 40
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: Extract metadata from audio files via command line?

 
0
  #4
Apr 15th, 2009
you may search the CPAN library for Audio::Taglib. ( there are others, so pls do a search).
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC