Hii,
Below I have written a script for get the time duration of a MP3 file-
For this first you need to download the getID3, You can download form http://getid3.sourceforge.net/ OR https://github.com/JamesHeinrich/getID3/ .
After downloading the library, please use the following code with your mp3 file-
<?php
require_once('getid3/getid3.php');
$getID3 = new getID3;
$path = 'Sample.mp3';
$mixinfo = $getID3->analyze( $path );
getid3_lib::CopyTagsToComments($mixinfo);
$bit_rate = $mixinfo['audio']['bitrate'];
$play_time = $mixinfo['playtime_string'];
list($mins , $secs) = explode(':' , $play_time);
if($mins > 60)
{
$hours = intval($mins / 60);
$mins = $mins - $hours*60;
}
$play_time = sprintf("%02d:%02d:%02d" , $hours , $mins , $secs);
echo $play_time;
?>
0 Comment(s)