I am good in php but very new to ffmpeg and exec stuffs.Now I have successfully installed ffmpeg via ssh.I referred some stackoverflow here and found below code to make video using several images.
<?php
echo exec('ffmpeg -f image2 -i image%d.jpg video.mpg');
?>
I have image1.jpg and image2.jpg in same folder.I run this php code but nothing happened...where does video.mpg gets saved ? and how to check if exec function ran successfully or how to debug it ?Any help is appreciated.
If it successfully worked, video.mpg got saved in your current working directory. If needed you can change filenames to absolute paths.
To check if
exec()
function ran successfully you can pass the third argument to get the exit status:If successful,
$exit_status
will got0
value, so:If it's failling you might want to get errors on
$output
. You can moveSTDERR
toSTDOUT
ignoring originalSTDOUT
this way:Then you could dump
$output
to see what you got onSTDERR
:If the video.mpg file already exists the command will get stuck, you might want to pass
-y
flag toffmpeg
to overwrite any existing file: