3

I am using exec() function to run my commands on centos server. All was working fine untill i used command: $command= ffmpeg -i input video.mp4 -vf fade=out:0:5 output.mp4

The command is ok as it is running on server via command line but when i execute it using php it is not giving the output. I have already created a video from ffmpeg using the exec() function but this command is not working. What can be the reason i am confused how a command can run on server but not work while executing from php.

Other command i executed using exec() function is : $command = ffmpeg -i %d.jpg -y -s 320x240 -aspect 4:3 output.mp4

and it is working perfectly and the video is also created but previous command is not giving video as output.

Please guide me...

4
  • 4
    Could you copy/paste the exact PHP you're using? Quoting is important. Commented Sep 28, 2011 at 5:41
  • 3
    As is tagging the question with the language in use. Commented Sep 28, 2011 at 5:41
  • 1
    are you sure your input file name is called input video.mp4, with a space in the middle? Commented Sep 28, 2011 at 6:27
  • no there is no space. The actual command is: ffmpeg -i fade.mp4 -vf "fade=out:0:5" output.mp4. My exact php code is:$command= 'ffmpeg -i slideshow/frame1.mp4 -vf "fade=out:0:5" slideshow/fade1.mp4' exec($command) Commented Sep 28, 2011 at 7:22

1 Answer 1

2

Try debugging you command execution. For ffmpeg you need to pipe the output with 2>&1 to see it:

exec($command." 2>&1", $output);
echo "<pre>";
var_dump($output);
echo "</pre>";
Sign up to request clarification or add additional context in comments.

4 Comments

It is returning: string(37) "frame1.mp4: No such file or directory" but frame1.mp4 is present at the location slideshow/. Why it is not able to find the file?
Try using the full path to the file and check the file permissions.
When i used the full file path with file permissions 777 i get:string(24) "Unrecognized option 'vf'" . What else i should use to refer to filters i also tried -vfilters but the same error comes...
-vf should work. Check out the Doku, looks ugly but helps a lot!

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.