1

I have installed ffmpeg on my server and it works fine via my terminal. I'm able to successfully convert a file to webm format, so I'm sure the installation is fine. I'm also sure that I only have one installation of ffmpeg installed on my machine.

A problem arises when I try to convert files through PHP via PHP's exec(). When I run the same commands, I ran in the terminal, nothing happens. I looked around stackoverflow and other parts of the net for some help. I tried this to see the output:

exec($cmd, $out, $rv);
echo "output is:\n".implode("\n", $out)."\n exit code:$rv\n";

The output is: "output is: exit code:127"

The command I'm using is in this format:

ffmpeg -i "sample.mov" -vcodec libvpx  -r 30 -b "644k" -acodec libvorbis -ab 128000   -ar "44100" -ac 2 -s "352x198" "sample.webm"

I've tried replacing "ffmpeg" with the full path to FFmpeg but that did not work.

Why isn't the script running the command correctly and converting the files?

Thank you!

7
  • 2
    It's "¿Por qué?" (two words) ;-P Commented Aug 30, 2011 at 6:21
  • Search for ffmpeg status 127 error. Does your command run ok without php? Commented Aug 30, 2011 at 6:22
  • facepalm. Thanks, I forgot :p Commented Aug 30, 2011 at 6:27
  • The command works perfectly in my terminal. Commented Aug 30, 2011 at 6:28
  • Possible duplicate of stackoverflow.com/questions/4828083/ffmpeg-php-error-code-127 Commented Aug 30, 2011 at 6:29

2 Answers 2

3

Error code 127 means the executable (ffmpeg) couldn't be found. Try specifying the whole path (you can that out find in your terminal with which ffmpeg) or compare the value of the PATH environment variable in your php script and terminal.

Sign up to request clarification or add additional context in comments.

1 Comment

"I've tried replacing "ffmpeg" with the full path to FFmpeg but that did not work."
1

I have similar problem with ant target executions from php. I can't get whole output from ant command only first few rows and ant target was not executed. In other words is partial executed.

With bellow command I've managed to run it but output of the command is append to log_file.log.

$commandString = 'you_command_here >> log_file.log 2>&1 &';
$command = exec($commandString);

Hope this will work for you.

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.