TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-13-2008, 09:46 PM   #1 (permalink)
The Contributor
 
oMIKEo's Avatar
 
Join Date: Jan 2008
Location: Leeds
Posts: 52
Thanks: 7
oMIKEo is on a distinguished road
Default ffmpeg converting using a cronjob

Hi,

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:
PHP Code:
$dir_root "../../var/www/html/uploads/media/";
$temp_new substr($o_newname0strripos($o_newname'.'));

$output exec ("ffmpeg -i ".$dir_root.'o_'.$o_newname." -s qvga -y ".$dir_root.'n_'.$temp_new.".flv");
echo(
$output); 
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:
Code:
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?

Regards,
Michael
Send a message via MSN to oMIKEo
oMIKEo is offline  
Reply With Quote
Old 05-14-2008, 02:03 PM   #2 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

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.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 05-14-2008, 02:10 PM   #3 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

Also, after reading the manual, exec can return values, you just need to specify it;
PHP Code:
exec('whoami'$array$returnStatus);
echo 
print_r($array); 
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 05-14-2008, 04:24 PM   #4 (permalink)
The Contributor
 
oMIKEo's Avatar
 
Join Date: Jan 2008
Location: Leeds
Posts: 52
Thanks: 7
oMIKEo is on a distinguished road
Default

ok i changed the script to do this:

PHP Code:
$output exec ("ffmpeg -i ".$dir_root.'o_'.$o_newname." -s qvga -y ".$dir_root.'n_'.$temp_new.".flv",$arrayOutput$returnOutput);

echo 
print_r($arrayOutput); 
echo 
'<br />';
echo 
print_r($returnOutput); 
and got the following:
PHP Code:
Array ( ) 1
11 
Any idea what that means?

I then tried this:
PHP Code:
$output shell_exec("ffmpeg -i ".$dir_root.'o_'.$o_newname." -s qvga -y ".$dir_root.'n_'.$temp_new.".flv");
echo 
"<pre>$output</pre>"
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.
Send a message via MSN to oMIKEo
oMIKEo is offline  
Reply With Quote
Old 05-14-2008, 07:23 PM   #5 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

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.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:23 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design