I want to convert a video to flv format. I am using ffmpeg to convert the video. I am using 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 is working correctly in the local system. But in the server it is not working correctly.
In the server i changed the code as 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 have given the Source path as C:/wamp/www/newtip/ But in server i have given the path as http://www.mydomain.com/newtip/ .I think in the server the path is wrong. Can anybody tell me how to give the path in the server?
Try to specify the correct directory and also specify the document root with:
$path = $_SERVER['DOCUMENT_ROOT'] . "your required folder path here";
Make sure that:
exec
is not disabled.You are confusing paths and urls. In place of http://www.mydomain.com/newtip/ffmpeg/ffmpeg
, use the full path (something like... /home/username/mydomain.com/newtip/ffmpeg/ffmpeg
). As Sarfraz recommends, you can use $_SERVER['DOCUMENT_ROOT']
to find the root for your path.
exec()
runs on PHP which runs on the server, so use the path as if you're truly running it on the server with the local paths.
i had exact the same problem, it turned out to be the codec.
-acodec mp3
is working on local but the server required -acodec libmp3lame