On Fri, 26 Jul 2002, Brian wrote:
> I'm trying to write a small script to determine the length (time) of an
> MP3.  mpg123 displays the time after it's done, but I can't pipe that text
> to anything and strip it out.  There's a mathmatical calculation I could
> do by dividing size/bitrate, but I can't determine the bit rate cleanly
> from the file.  Any ideas on how to do this?

 I'd use mp3info:

$ mp3info -f "%m %s" example.mp3
3 35

 Or if you just want seconds:

$ mp3info -f "%S" example.mp3
215

 You can format it however you like, it seems rather flexible.

     Jima