Converting Videos Using PHP

In fact, video conversion on the server side is done by other softwares. PHP itself is used as a medium for the task maximum times.

We have a nice command line tool named “ffmpeg” to convert videos. I am currently working on a youtube video conversion tool and using ffmpeg to convert the videos from “.flv” to my desired format.

On my linux machine this simple command is enough to convert a “.flv” video to “.mpg” :

Using php, I do the same. PHP has a function shell_exec() that lets you execute any shell command from PHP. So, this is what I do from PHP:

That does the job for me 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *