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
- Defined an variable called FFMPEG_LIBRARY that holds the path to FFMPEG Libraries
- Finally i am calling exec() function that executes the FFMPEG command
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.


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