[Flac-users] is there a way to read the length of a song from the command line?
Josh Coalson
xflac at yahoo.com
Sun Jun 20 14:37:04 PDT 2004
--- Kevin Seghetti <kts at tenetti.org> wrote:
> I am working on an audio jukebox and would like to read the length of
> a
> song (minutes:seconds) from a perl script. Is there a way to do that?
> I
> don't see anything in the docs for flac or metaflac.
you can get the total number of samples with
metaflac --show-total-samples file.flac
then get the sample rate with
metaflac --show-sample-rate file.flac
divide the first by the second and that gets you the number of
seconds.
there is also a perl module Audio::FLAC that does all this:
http://search.cpan.org/~daniel/Audio-FLAC-0.7/FLAC.pm
Josh
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
More information about the Flac
mailing list