RE: [PHP] can't get output of exec ('nice -n 19 ffmpeg -i file')
I think nice may play games with fork etc and may be confusing php. Try putting the nice -n 19 ffmpeg -I bit into a mini shell script of its own, and call that. -Original Message- From: Rene Veerman [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2008 1:54 PM To: php-general@lists.php.net Subject: [PHP] can't get output of exec ('nice -n 19 ffmpeg -i file') Hi, i have the following php statements; I'm wondering why exec()'s $output remains empty.. Any help is greatly appreciated.. ?php $cmd = 'nice -n 19 ffmpeg -i '.$sourcePath.''; exec ($cmd, $output, $result); return array ( 'cmd' = $cmd, 'output' = $output, 'result' = $result ); which when executed returns [cmd]=string(128) nice -n 19 ffmpeg -i /data/web/secret/20080929 201651/work/MVI_1993.avi [output]=array(0) { } [result]=int(1) } if i run the same cmd on the commandline, it nicely returns: FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-mp3lame --enable-faad --enable-dc1394 --disable-debug --enable-shared --prefix=/usr libavutil version: 0d.49.0.0 libavcodec version: 0d.51.11.0 libavformat version: 0d.50.5.0 built on Sep 29 2008 18:43:44, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Input #0, avi, from '/data/web/LIVE_WEBSITES/www/veerman.name/mediaBeez_content/media/uploa d/20080929 201651/work/MVI_1993.avi': Duration: 00:01:45.6, start: 0.00, bitrate: 1746 kb/s Stream #0.0: Video: mjpeg, yuvj422p, 320x240, 15.00 fps(r) Stream #0.1: Audio: pcm_u8, 11024 Hz, mono, 88 kb/s Must supply at least one output file -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ The information in this email or in any file attached hereto is intended only for the personal and confiden- tial use of the individual or entity to which it is addressed and may contain information that is propri- etary and confidential. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communica- tion is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product. Email trans- mission cannot be guaranteed to be secure or error- free. P6070214 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can't get output of exec ('nice -n 19 ffmpeg -i file')
On Mon, 2008-09-29 at 20:53 +0200, Rene Veerman wrote: Hi, i have the following php statements; I'm wondering why exec()'s $output remains empty.. Any help is greatly appreciated.. ?php $cmd = 'nice -n 19 ffmpeg -i '.$sourcePath.''; exec ($cmd, $output, $result); return array ( 'cmd' = $cmd, 'output' = $output, 'result' = $result ); which when executed returns [cmd]=string(128) nice -n 19 ffmpeg -i /data/web/secret/20080929 201651/work/MVI_1993.avi [output]=array(0) { } [result]=int(1) } if i run the same cmd on the commandline, it nicely returns: FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-mp3lame --enable-faad --enable-dc1394 --disable-debug --enable-shared --prefix=/usr libavutil version: 0d.49.0.0 libavcodec version: 0d.51.11.0 libavformat version: 0d.50.5.0 built on Sep 29 2008 18:43:44, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Input #0, avi, from '/data/web/LIVE_WEBSITES/www/veerman.name/mediaBeez_content/media/upload/20080929 201651/work/MVI_1993.avi': Duration: 00:01:45.6, start: 0.00, bitrate: 1746 kb/s Stream #0.0: Video: mjpeg, yuvj422p, 320x240, 15.00 fps(r) Stream #0.1: Audio: pcm_u8, 11024 Hz, mono, 88 kb/s Must supply at least one output file You could do $cmd = 'nice -n 19 ffmpeg -i '.$sourcePath.''; $output = shell_exec($cmd); Don't forget though, that as this is making PHP wait for output from the shell, a lengthy shell process could mean the PHP script times out (depending on your timing settings) and I think this will cause the exec command to fail. What you could consider is to execute a bash script that itself makes an entry someplace, either through the command line PHP, command line SQL or editing a file that PHP can look at later. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can't get output of exec ('nice -n 19 ffmpeg -i file')
On Mon, Sep 29, 2008 at 2:53 PM, Rene Veerman [EMAIL PROTECTED] wrote: Hi, i have the following php statements; I'm wondering why exec()'s $output remains empty.. Any help is greatly appreciated.. ?php $cmd = 'nice -n 19 ffmpeg -i '.$sourcePath.''; exec ($cmd, $output, $result); return array ( 'cmd' = $cmd, 'output' = $output, 'result' = $result ); Try this instead, just to make sure everything's running as expected: ?php $cmd = 'nice -n 19 ffmpeg -i '.$sourcePath.' 21'; exec($cmd,$ret,$err); print_r($ret); ? $ret (or whatever you name the second parameter of exec()) will always be an array, regardless of the actual output from the command. You'll need to be sure you have shell access and the ability to execute system commands as whatever user the PHP script is running (your own user, apache, httpd, nobody, daemon, pscln, etc.). Redirecting the error channel to stdout (using the 21 redirect at the tail of the command) will also give you the full program response on $ret, which is then dumped in full using print_r() as shown above. -- /Daniel P. Brown More full-root dedicated server packages: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can't get output of exec ('nice -n 19 ffmpeg -i file')
bingo, this fixed it :) thx (all) for answering so quickly :) Daniel Brown wrote: Try this instead, just to make sure everything's running as expected: ?php $cmd = 'nice -n 19 ffmpeg -i '.$sourcePath.' 21'; exec($cmd,$ret,$err); print_r($ret); ? $ret (or whatever you name the second parameter of exec()) will always be an array, regardless of the actual output from the command. You'll need to be sure you have shell access and the ability to execute system commands as whatever user the PHP script is running (your own user, apache, httpd, nobody, daemon, pscln, etc.). Redirecting the error channel to stdout (using the 21 redirect at the tail of the command) will also give you the full program response on $ret, which is then dumped in full using print_r() as shown above. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can't get output of exec ('nice -n 19 ffmpeg -i file')
I have other ffmpeg statements that i execute in the same manner. They do produce the desired result-files, but also do _not_ have $output set to the text i see when i run the commands from the commandline.. I'd like to get output from all my executions of ffmpeg, its usefull for detailing error reporting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php