PHP Function to Get Mp3 Duration

PHP Function to get MP3 duration

This should work for you, notice the getduration function: http://www.zedwood.com/article/127/php-calculate-duration-of-mp3

Get length of mp3 file

Try to use this getduration function: http://www.zedwood.com/article/127/php-calculate-duration-of-mp3

How to get duration of mp3 file in laravel 5.5

You can use package wapmorgan/mp3info

composer require wapmorgan/mp3info

Then you can use the library as follows.

$audio = new \wapmorgan\Mp3Info\Mp3Info($fileName, true);
$audio->duration \\ duration in seconds

Get the length of an audio file php

What kind of audio file? mp3? wav?
Anyway you will probably need some specific library.
See: http://de.php.net/manual/en/refs.utilspec.audio.php

Converting MP3 duration time

$minutes = bcmod(($duration / 60), 60);

is taking the minutes modulo 60. Unless your track is over an hour it will always say 0.
You want it to be

$minutes = floor($duration / 60);


Related Topics



Leave a reply



Submit