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
benyboi
Forum Commoner
Posts: 80 Joined: Sat Feb 24, 2007 5:37 am
Post
by benyboi » Sun Aug 19, 2007 7:50 pm
hello,
im trying to use ffmpeg...
using this php code for running commands works:
Code: Select all
<?php
echo '<pre>';
// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = system('ipconfig', $retval);
// Printing additional info
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?>
but when i put
D:\inetpub\software\ffmpeg\bin\ffmpeg.exe -i test.wmv out.avi
for the command it just wont run?
im running latest apache, php and mysql.
whats wrong?
thanks,
ben
Last edited by
benyboi on Mon Aug 20, 2007 7:14 am, edited 1 time in total.
benyboi
Forum Commoner
Posts: 80 Joined: Sat Feb 24, 2007 5:37 am
Post
by benyboi » Mon Aug 20, 2007 6:59 am
i tried setting permissions on ffmpeg.exe but that doesnt sort it...
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Mon Aug 20, 2007 7:06 am
1. What do you have in the error logs?
2. Use full path for test.wmv and out.avi files.
There are 10 types of people in this world, those who understand binary and those who don't
benyboi
Forum Commoner
Posts: 80 Joined: Sat Feb 24, 2007 5:37 am
Post
by benyboi » Mon Aug 20, 2007 7:13 am
noooo way!
you are a genious! it works
wait - how can i make it run in the background? so that the php loads even thought the video is still converting. and so i dont get the 30 second limit thing (i dont want to change that in php.ini)
thanks for you help
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Mon Aug 20, 2007 7:32 am
Untested!
Code: Select all
<?php
$runCommand = "YOUR COMMAND AND ITS PARAMS HERE";
if(isset($_SERVER['PWD'])//*nix (aka NOT windows)
{
$nullResult = `$runCommand > /dev/null &`;
}
else //windowz
{
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($runCommand, 7, false);
}
?>
Last edited by
VladSun on Wed Jan 23, 2008 7:20 am, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Aug 20, 2007 8:24 am
I would check PHP_OS (it's a constant) over a $_SERVER variable.
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Mon Aug 20, 2007 8:33 am
feyd wrote: I would check PHP_OS (it's a constant) over a $_SERVER variable.
Yeah, it would be better. That was the first example found by google
There are 10 types of people in this world, those who understand binary and those who don't