PHP Function to get MP3 duration

Install getid3, but if you only need duration, you can delete all but these modules:

  • module.audio.mp3.php
  • module.tag.id3v1.php
  • module.tag.apetag.php
  • module.tag.id3v2.php

Access the duration with code like this:

$getID3 = new getID3; $ThisFileInfo = $getID3->analyze($pathName); $len= @$ThisFileInfo['playtime_string'];

Get it at Sourceforge

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

WordPress.com.

Up ↑

%d bloggers like this: