-1

I have a url of the wav file http://xyz.com/recordings/employees/test.wav

What i want to know is how can i change this file into mp3 format and store it in a particular location using php script because this file is located in some other server?

I know about ffmpeg but not sure whether it will work or not.

Pankaj Khurana
  • 3,243
  • 10
  • 50
  • 79
  • thanks cweiske for replying can you please tell me the code given on http://wiki.dreamhost.com/Php-ffmpeg will work on my web host (hostgator) also since it is shared hosting i have to ask them for installation? – Pankaj Khurana Jul 05 '11 at 05:48

3 Answers3

4

I hope you have linux:

exec('wget http://xyz.com/recordings/employees/test.wav');
exec('ffmpeg -i test.wav test.mp3');
exec('mv test.mp3 /youlocation/test.mp3');
TheHorse
  • 2,787
  • 1
  • 23
  • 32
  • thanks thehorse for replying have to confirm from hosting provider? – Pankaj Khurana Jul 05 '11 at 05:52
  • if you use hosting with out root access you have to verify that your hoster have ffmpeg. – TheHorse Jul 05 '11 at 05:58
  • i had a talk with hosting provider i have to upgrade my account in order to execute the command. Can you please suggest whether there is any other library available for it which does not require commandline access. – Pankaj Khurana Jul 05 '11 at 06:18
  • i thikn there is no such liblary – TheHorse Jul 05 '11 at 06:38
  • ffmpeg is open source and can be build/distributed without needing to 'install' a package from your hosting provider if that is the problem. There are even static builds available if you don't have access to compilers... https://www.ffmpeg.org/download.html – g19fanatic Aug 30 '17 at 15:47
0

Thats usually no problem you may download this file to your webserver to a temporary folder. Than you have to convert it. There is e.g. a ffmpeg extension to php but not shipped with the php distribution afaik.

But even if you do not have this you can invoke a commandline on e.g a linux shell

ffmpeg -i /sometmpfolder/tmp.wav destination.mp3
fyr
  • 20,227
  • 7
  • 37
  • 53
  • thanks fyr for replying since i have shared hosting i think i have to confirm from them whether i can invoke commandline or not? – Pankaj Khurana Jul 05 '11 at 05:51
  • yes thats one option another one would be to check whether you have the extension installed/configured via phpinfo() – fyr Jul 05 '11 at 05:55
  • i have to upgrade my account to execute these commands. can you please suggest any other library which does not require command line access. – Pankaj Khurana Jul 05 '11 at 06:20
0

I have found an api which does this conversion process. The link for this is: Api for conversion

Pankaj Khurana
  • 3,243
  • 10
  • 50
  • 79