| | |
Extract metadata from audio files via command line?
![]() |
•
•
Join Date: Jan 2006
Posts: 11
Reputation:
Solved Threads: 1
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
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
•
•
Join Date: Apr 2006
Posts: 148
Reputation:
Solved Threads: 40
if you have Perl, you can use the MP3::Tag module.
eg
it is able to update tag info as well. Read its documentation for how to edit the tags.
eg
Shell Scripting Syntax (Toggle Plain Text)
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";
•
•
Join Date: Jan 2006
Posts: 11
Reputation:
Solved Threads: 1
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
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.
•
•
Join Date: Apr 2006
Posts: 148
Reputation:
Solved Threads: 40
you may search the CPAN library for Audio::Taglib. ( there are others, so pls do a search).
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- attack on 3d programs? HELP! (Viruses, Spyware and other Nasties)
- Win XP protected processes raised their priority, 3d programs unrunnable (Windows NT / 2000 / XP)
Other Threads in the Shell Scripting Forum
- Previous Thread: Line addressing with sed using a variable
- Next Thread: problem with input redirection in MS-DOS
| Thread Tools | Search this Thread |





