This is my script:

echo "Starting ffmpeg...\n\n<br>";
$cmd = "ffmpeg -i video.mp4 -ss 00:01:30.35 -vframes 1 img.png"; 
echo shell_exec($cmd);

When I run it from CMD it works just fine but nothing happens when I run it from php. I have tried both exec and shell_exec. I have heard I should run ffmpeg as a background process. How can I do this?

1 Answer 1


Use this:


You won't need echo. This should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy