Re: can't get output of exec ('nice -n 19 ffmpeg -i "file"')

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.000000, 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux