0

I'm trying to run ffmpeg in my WAMP server with the exec command. Though I have set in the .htaccess file "php_value safe_mode off" and apache allow the override, the exec is still not working properly. if I try to execute

   <?
   php exec("mkdir aaa");  
   ?>

it works, but when I do something like

    exec("ffmpeg.exe -y -i D:\Documents\Video.wmv -f mp4  D:\Documents\Video.mp4 -y");

it doesn't do nothing. This works fine is prompted in the command line, but for some reason it doesn't when I try to execute it from the server. Do you have any ideas?

1
  • 1
    Is ffmpeg.exe in the PATH evn variable for the shell run under Apache? (Check environment with phpinfo.) Commented Oct 18, 2011 at 21:18

1 Answer 1

2

You need to escape backslashes in string literals:

exec("ffmpeg.exe -y -i D:\\Documents\\Video.wmv -f mp4  D:\\Documents\\Video.mp4 -y");
Sign up to request clarification or add additional context in comments.

1 Comment

Sucks that this has to be done manually, seems like escapeshellarg() should handle escaping backslashes.

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.