Custom Search

Execute FFMPEG Command in PHP

It has been a nightmare for me searching for executing FFMPEG command from PHP. But finally i got the solution for executing ffmpeg from php script. This article will guide you on how to convert videos and audios using FFMPEG from within the PHP scripts.





NOTE:
I have tested this on Red Hat Enterprise(RHEL). Not sure about other Linux OS like Ubuntu etc. But i would say if it works then its rocking to execute FFMPEG inside the php scripts.

PHP Script

1
2
3
4
5
< ?
   define('FFMPEG_LIBRARY', '/usr/local/bin/ffmpeg ');
   $exec_string = FFMPEG_LIBRARY.' -i inputfile.mpg outputfile.flv';
   exxc($exec_string); //where exxc is the command used to execute shell command in php
?>





PHP Code Explanation

Similar Posts

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

above command is not working.in php script. Pls help

Hi skvenkate,
I think you have not enabled some parameter required for ffmpeg to work with PHP. Can u please check crosscheck the installation steps for ffmpeg with this article http://www.hiteshagrawal.com/ffmpeg/installing-ffmpeg-easily-on-linux

a litte error in your PHP script : “exxc” doesn’t exist, I think “exec” is better ;)

This isnt working at all at my script. It just shows me blank page. And it doesnt create anything at all. Can anyone help me at this? If this worked out for you, please tell me. Thanks.

nice one

Leave a comment

(required)

(required)