0
  • I have ffmpeg installed
  • safe_mode is off
  • when i do this: $movie = new ffmpeg_movie('Bear.wmv'); I can use getDuration(), getFilename().... wthout any problems, so it's all seems to be working
  • exec is working fine, cos when i do: $output = exec('ls -lart'); I get a nice little result.

but when I do this:

exec('ffmpeg -i Bear.wmv outputfile.flv')

nothing happens

if I add: $command_output, $result the only result i guess is: array { }

I have tried everything I could think of:

exec('ffmpeg -i Bear.wmv outputfile.flv')

exec('ffmpeg.so -i Bear.wmv outputfile.flv')

exec('/usr/lib/php5/20090626/ffmpeg -i Bear.wmv outputfile.flv')

I've tried all sizes and folders and codecs but still don't get anything back

All i wanna do is convert that video, Bear.wmv to an flv file.

I'm very close to crying like a baby and/or jumping out of the window (im only on the first floor but still lol) so Please help!!??!

2 Answers 2

1

FFMPEG is a application wich don't output to STDIO but STDERR, so you can redirect it to standard output:

$cmd = $FFMPEGDIR . " -i somefile.avi 2>&1"; // SEE 2>&1 !!

Extracting size:

 exec( $cmd , $info );

      echo "<pre>".print_r($info,true)."</pre>";
      $resolution = preg_match( '@[ ,\t]([0-9]{3,4}x[0-9]{3,4})[ ,\t]@si' , implode( " " , $info ) , $durmatches );

      $rtab = explode( "x" , $durmatches[1] );

      $videowidth = $rtab[0];
      $videoheight = $rtab[1];
Sign up to request clarification or add additional context in comments.

Comments

0

Recently set ffmpeg up for audio stuff... it's a bit of a black art, ffmpeg is notorious for not playing nice (or consistently) - what works (worked) for me might not work for you!

try using: shell_exec()

or:

$command="{$FFMPEG_BINARY} ... rest of your options";
$process=proc_open($command, $descriptors, $pipes);
if (!$process)
{
    // failed to exec...
}
else
{
    // command ran...
}

my ffmpeg was in... "/usr/bin/ffmpeg" just check you've got right path too.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.