0

Possible Duplicate:
Automatically trimming a mp3 in PHP

Hi

I am working on a project for a client that will involve the selling of mp3's.

The client would like to be able to simply upload the mp3 and the system will automatically generate a sample of the first 30 seconds of the full mp3.

Can this be done via code?

Thanks

Regards Gabriel

Community
  • 1
  • 1
Gabriel Spiteri
  • 4,896
  • 12
  • 43
  • 58

2 Answers2

1

If you are using Linux as your production platform you might have to consider using approaches from http://www.go2linux.org/trim-cut-join-split-mp3-files-with-linux

Just call these comnmands from php via system or exec functions

Konstantin
  • 24,271
  • 5
  • 48
  • 65
  • This looks interesting too ... the class suggested here http://stackoverflow.com/questions/1404969/automatically-trimming-a-mp3-in-php seems to do the job fine. Thanks anyways will keep this in mind just in case. – Gabriel Spiteri Apr 25 '11 at 09:07
0

Yes and no...

Yes : Php could call a simple binary which do the job (params included) with exec() or passthru().

And No : php isn't able (whitout extension) to process mp3 files. I had the same problem with videos: i used ffmpeg (Linux command line processing program for videos) launched thru php in order to generate 30sec samples and screenshots.

Manu Eidenberger
  • 2,076
  • 1
  • 18
  • 23
  • I guess you can always program mp3 splitter in pure PHP so it can be used without additional extensions, but this will cost a lot of time and efforts ;) – Konstantin Apr 25 '11 at 08:35