How To Extract Duration From.mp3/.ogg Using Php?

Is there a simple way (without installing a huge library etc.) using PHP to get the duration (in seconds) from .ogg and .mp3 files? (average bitrate would be great, too, but not as important)

I’ve been searching, but everything I found so far is about doing more complicated stuff like encoding etc.

Usually there some good stuff:

pipe out to an external command line utility like mp3info:

command > mp3info -p '%m:%02s\n" abc.mp3
results > 17:03

Cheers and thanks guys, but I found something even more greatest!!

It’s total overkill for what I need, but since it’s only called when new files are being scanned for (not every time they are listed) I think I can live with that.