|
Posted by sree on 08/10/06 10:14
Hi Leong,
Thanks for your effort.
can you explain how the number 245760 matches for 15s. If i want for
20s or anyother what i have to do?
Thanks and Regards.
Chung Leong wrote:
> 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]
|