1

I'm trying to run this command that does work in cli

ffmpeg -i tmp1.flv -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 output1.flv

I was able to run only ffmpeg -version by php.

$res = exec("C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe ffmpeg -version");

Location of tmp1.flv file:

C:\wamp\www\tmp1.flv

When I'm running $res = exec("chdir") => C:\wamp\www\

How can I run this by php

ffmpeg -i tmp1.flv -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 output1.flv

I tried:

$res = exec("C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe ffmpeg -i tmp1.flv -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 output1.flv", $output, $return_var);
$res = exec("C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe ffmpeg -i C:\\wamp\\www\\tmp1.flv -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 C:\\wamp\\www\\output1.flv", $output, $return_var);
$res = exec("C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe ffmpeg -i C:\wamp\www\tmp1.flv -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 C:\wamp\www\output1.flv", $output, $return_var);
$res = exec("C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe ffmpeg -i \"C:\wamp\www\tmp1.flv\" -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 \"C:\wamp\www\output1.flv\"", $output, $return_var);
$res = exec("C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe ffmpeg -i 'C:\wamp\www\tmp1.flv' -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 'C:\wamp\www\output1.flv'", $output, $return_var);
...

but echo $res and echo $output gives nothing, and echo $return_var gives 1

+++UPDATE+++

Made a little progress thanks to this post, it does give me output and info about the file, but still can't run the whole command.

$cmd = 'C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe ffmpeg -i tmp1.flv 2>&1';

exec($cmd, $output, $value);

var_dump($output);
var_dump($value);
var_dump($cmd)

+++UPDATE 2+++

echo exec('whoami') => nt authority\system

3
  • "To get the output of the executed command, be sure to set and use the output parameter. " ... php.net/manual/en/function.exec.php Commented May 4, 2015 at 14:08
  • have you checked if the user who executes the script has write access to the output directory? Commented May 4, 2015 at 14:16
  • @steven thank you, I check it again & It says that I'm nt authority\system Commented May 4, 2015 at 14:23

1 Answer 1

2

I had ffmpeg after ffmpeg.exe - that's why it didn't work.

$cmd = 'C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe -i tmp1.flv -c:a copy  -vf drawbox=:x=0:y=0:color=invert:t=2 output2.flv 2>&1';
exec($cmd, $output)
Sign up to request clarification or add additional context in comments.

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.