|
Posted by Chung Leong on 08/09/06 14:23
sree wrote:
> I want to crop the mp3 files using PHP.
>
> Actually i have to play the demo of a mp3 song to users. So, i have
> to crop the first 10 or 20 second of a song first, then it has to be
> downloaded and played.
MP3 files are sort of formless. If you don't need a precise length, you
can just cut a chunk out and send it. Example:
<?
header("Content-type: audio/mpeg");
$f = fopen($mp3_path, "rb");
echo fread($f, 245760);
fclose($f);
?>
That would grab the first 15 sec from a 128kbps mp3 file.
Navigation:
[Reply to this message]
|