Friday, October 10, 2008

Video Conversion Dynamically Using FFMPEG,PHP

Every programmer has an idea to convert the video file types dynamically into any formats on the fly. They all know there is a tool called FFMPEG to convert video formats to their desired formats which they want. In this tutorial i'll let you know how to use the FFMPEG tool during file upload dynamically.

1. Download FFMPEG.EXE from here
2. Extract the FFMPEG.EXE from the archive.
3. Place the FFMPEG.EXE in the webdirectory.
4. As you all know how to upload a file (So i'm moving to the next step).
5. After the file uploaded just put the below line
exec("ffmpeg -i recipe_videos/$path -f flv recipe_videos/$test[0].flv");
//Format exec("ffmpeg -i pathofthevideouploaded -f towhichformat wherethefiletobesavedwithextension");
6. If you want delete the old file.
7. Now you can view the video in the desired format.

5 comments:

Anonymous said...

It worked on my localhost.
WIll it work on a linux server as well?

Anonymous said...

Which revision should i download to work on both linux and windows

Sathish Kumar said...

you can use the latest & stable exe file for both windows & linux version. In windows you must ask your service provider to allow executing the exe file. Because in most of the windows server the firewall will protect to not executing the exe file directly.

Anonymous said...

In step 4, please tell us where to put that line in.

Hope you replay soon.

Sathish Kumar said...

After move_uploaded_file you can put the exec("") command