Automatically trimming an mp3 in PHP

Meep3D picture Meep3D · Sep 10, 2009 · Viewed 13.4k times · Source

Are there any ways to automatically trim an MP3 uploaded to a website to 30 seconds (or some other length) in PHP? If not, is there any good 3rd party services that could be integrated (transparently to the user) to achieve the same effect?

Thanks.

Answer

Sampson picture Sampson · Sep 10, 2009

You could try the MP3 Class on PHPClasses. It features the following example:

require_once './class.mp3.php';
$mp3 = new mp3;
$mp3->cut_mp3('input.mp3', 'output.mp3', 0, -1, 'frame', false);

In this case, the 'frame' can be substituted with 'second' to base the cut on a time-frame.