Exec and ffmpeg

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Exec and ffmpeg

Post by user___ »

Hi guys,
I have ffmpeg executable file in a folder on my document_root. When I try to execute it from other place different from the folder where it is installed it can not be found.

Do you know how to execute an executable file(In this case ffmpeg) from another directory?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: Exec and ffmpeg

Post by volka »

user___ wrote:I have ffmpeg executable file in a folder on my document_root.
$_SERVER['DOCUMENT_ROOT'] contains the name of this directory. see http://www.php.net/manual/en/reserved.variables.php
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Reply

Post by user___ »

Thank you, volka. I have read the info but I do not know how to start this ffmpeg from another directory.

Now the root looks like these:
C:/www/#The root
C:/www/movie_maker/executables/ffmpeg.exe#ffmpeg's location
C:/www/mySite/make_movie.php#Where I call it from.

Can you drop me a line with the exec() command in the above situation to see whether it will start working.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Just concatenate $_SERVER['DOCUMENT_ROOT'] and the "remaining path"§ the get the absolute path to ffmpeg.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Re: Reply

Post by dibyendrah »

user___ wrote:Thank you, volka. I have read the info but I do not know how to start this ffmpeg from another directory.

Now the root looks like these:
C:/www/#The root
C:/www/movie_maker/executables/ffmpeg.exe#ffmpeg's location
C:/www/mySite/make_movie.php#Where I call it from.

Can you drop me a line with the exec() command in the above situation to see whether it will start working.
Follow the following statements:

Code: Select all

$path_to_ffmpeg = "movie_maker/executables/ffmpeg.exe"
$cmd = $_SERVER['DOCUMENT_ROOT']."/".$path_to_ffmpeg;
Now just execute the $cmd variable using exec() or system() or shell_exec() functions.
Post Reply