问题
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.
回答1:
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');
回答2:
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
回答3:
I have found an api which does this conversion process. The link for this is: Api for conversion
来源:https://stackoverflow.com/questions/6578329/how-do-i-convert-wav-file-to-mp3-file-if-i-have-url-of-file-using-php