Page 1 of 1

shell_exec and exec problems

Posted: Tue Dec 19, 2006 1:33 pm
by izak30
I have two codes, the idea is to convert a video to flv with ffmpeg, using a php script.

Code: Select all

<?php

$output = shell_exec('ffmpeg -i unconverted/fg605.avi flv/fg605.flv');
print_r($output);

?>
outputs this:

Code: Select all

ffmpeg version 0.4.9-pre1, build 4730, Copyright (c) 2000-2004 Fabrice Bellard configuration: i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --extra-cflags=-O2 -march=i386 -mcpu=i686 --enable-mp3lame --enable-vorbis --enable-faad --enable-xvid --enable-pp --enable-shared-pp --enable-shared --enable-gpl --disable-strip built on Mar 10 2005 20:58:17, gcc: 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
The second code:

Code: Select all

<?php
$output = array();
exec('ffmpeg -i unconverted/fg605.avi flv/fg605.flv', $output);
print_r($output);

?>
outputs this:

Code: Select all

Array ( [0] => ffmpeg version 0.4.9-pre1, build 4730, Copyright (c) 2000-2004 Fabrice Bellard [1] => configuration: i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --extra-cflags=-O2 -march=i386 -mcpu=i686 --enable-mp3lame --enable-vorbis --enable-faad --enable-xvid --enable-pp --enable-shared-pp --enable-shared --enable-gpl --disable-strip [2] => built on Mar 10 2005 20:58:17, gcc: 2.96 20000731 (Red Hat Linux 7.3 2.96-113) )
As you can, see, they are both doing the same thing. The problem s that neither of them are writing the file (flv/fg605.flv) or giving me an output that is helpful.

Posted: Tue Dec 19, 2006 3:40 pm
by izak30
Just as an update, this does not work with absolute paths either. Any other ideas?

Posted: Tue Dec 19, 2006 4:40 pm
by impulse()
Try using

Code: Select all

system