How do i convert wav file to mp3 file if i have url of file using php?

佐手、 提交于 2019-12-12 01:29:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!