1

Possible Duplicate:
Automatically trimming a mp3 in PHP

I am currently serving mp3 files via php like the method described in this question: Can I serve MP3 files with PHP?

$track = "sometrack.mp3";

if(file_exists($track)) {
    header("Content-Transfer-Encoding: binary"); 
    header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3");
    header('Content-length: ' . filesize($track));
    header('Content-Disposition: filename="sometrack.mp3"');
    header('X-Pad: avoid browser bug');
    header('Cache-Control: no-cache');
    print file_get_contents($track);
} else {
    echo "no file";
}

How can I server a cut mp3. Like I want to take out the first XX seconds in the file and directly serve it from XX seconds so that the user only gets it from the XX seconds and not from the 00 seconds

Community
  • 1
  • 1
footy
  • 5,803
  • 13
  • 48
  • 96
  • You need a program that can cut mp3 files? - http://mp3splt.sourceforge.net/mp3splt_page/home.php – hakre Mar 28 '12 at 07:16
  • @hakre yes. I need to dynamically cut XX portions in mp3. I need to write a program for the same and so was wondering how to do the same. – footy Mar 28 '12 at 07:17
  • you can output file partically with byte size, but if you want to detect the timeline on mp3, you must use a library for manipulate mp3 – safarov Mar 28 '12 at 07:19
  • you can use PHP mp3 library. – Pooja Khatri Mar 09 '18 at 07:34

1 Answers1

1

You can install mp3splt to create a short version. Use shell_exec() to execute.

pät
  • 543
  • 3
  • 9