Converting video to flv format with ffmpeg works locally but does not work on server

I want to convert video to FLV format. I am using ffmpeg to convert video. I am using the following code.

exec("C:/wamp/www/newtip/ffmpeg/ffmpeg -i C:/wamp/www/newtip/ffmpeg/videos/".$name." -ar 22050 -ab 32 -f flv -s 320x240 C:/wamp/www/newtip/ffmpeg/players/".$name_s.".flv");

      

It works correctly on the local system. But it doesn't work properly on the server.

On the server, I changed the code below

exec("http://www.mydomain.com/newtip/ffmpeg/ffmpeg -i http://www.mydomain.com/newtip/ffmpeg/videos/".$name." -ar 22050 -ab 32 -f flv -s 320x240 http://www.mydomain.com/newtip/ffmpeg/players/".$name_s.".flv");

      

In local I gave the source path as C: / wamp / www / newtip / But on the server I gave the path as http://www.mydomain.com/newtip/ . I think the path on the server is wrong. Can anyone tell me how to point the path on the server?

+2


a source to share


4 answers


Try to point to the correct directory and also point to the document root with:

$path = $_SERVER['DOCUMENT_ROOT'] . "your required folder path here";

      



Make sure that:

  • The folder has the required permissions, chmod is 755
  • exec

    not disabled.
0


a source


You are confusing paths and urls. http://www.mydomain.com/newtip/ffmpeg/ffmpeg

Use the full path (something like ... /home/username/mydomain.com/newtip/ffmpeg/ffmpeg

) instead . As Sarfraz recommends, you can use $_SERVER['DOCUMENT_ROOT']

to find the root for your path.



0


a source


exec()

runs on PHP which runs on the server, so use the path as if you were actually running it on the server with local paths.

0


a source


I had the exact same problem, it turned out to be a codec.

-acodec mp3

runs on local server but requires a server -acodec libmp3lame

0


a source







All Articles