||05-13-2008 09:46 PM
ffmpeg converting using a cronjob
I'm making some progress with ffmpeg but need some help working out why i cant run the same code using php as when i run in ssh.
Here is the php:
$dir_root = "../../var/www/html/uploads/media/";
$temp_new = substr($o_newname, 0, strripos($o_newname, '.'));
$output = exec ("ffmpeg -i ".$dir_root.'o_'.$o_newname." -s qvga -y ".$dir_root.'n_'.$temp_new.".flv");
its a bit of a mess but its basically getting the input video, setting the size to 320x240 (qvga) and then outputting it as a .flv. When i use that output in ssh it works fine but when i run the above script it doesnt seem to do anything.
ffmpeg is located: /usr/bin/ffmpeg
website is location: /var/www/html/
Here is an example of what i paste into ssh:
ffmpeg -i ../../var/www/html/uploads/media/o_l2mWwMYOmDhuieDpNnb.avi -s qvga -y ../../var/www/html/uploads/media/n_l2mWwMYOmDhuieDpNnb.flv
is there any way to get some error checking in there or get an output back from the exec/ffmpeg command?
||05-14-2008 02:03 PM
exec will only return the last line which in this case might be a blank line.
Is safemode on? If safemode is on, exec will not work.
You could also try PHP: shell_exec - Manual
I believe shell_exec
returns all output as a string.
||05-14-2008 02:10 PM
Also, after reading the manual, exec can return values, you just need to specify it;
exec('whoami', $array, $returnStatus);
||05-14-2008 04:24 PM
ok i changed the script to do this:
$output = exec ("ffmpeg -i ".$dir_root.'o_'.$o_newname." -s qvga -y ".$dir_root.'n_'.$temp_new.".flv",$arrayOutput, $returnOutput);
echo '<br />';
and got the following:
Any idea what that means?
I then tried this:
$output = shell_exec("ffmpeg -i ".$dir_root.'o_'.$o_newname." -s qvga -y ".$dir_root.'n_'.$temp_new.".flv");
i didnt get an onscreen output but the code read <pre></pre> thats was it.
Thanks for your help!
PS: safe mode is not turned on.
||05-14-2008 07:23 PM
Hmm, not sure.
Does the PHP user have access to run ffmpeg? There may be a potential permissions problem.
That does tell me that nothing is being returned from the command line though;
What happens when you do just exec 'whoami'? See if that returns any information in the array.
|All times are GMT. The time now is 01:25 AM.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0