flv, ffmpeg and PHP: File conversion

Hi friends,

2 days ago I got a project in which I have to upload avi, mpeg or 3gp movie clip and convert this clip to flv as well generate thumbnail for this video. I know that this can be done through ffmpeg. But I didn,t know how haha..

Well I searched enough and start making environment for development. I did following mistakes.. I am listing those  mistakes. I am 100% sure it will save your day.

I was using Windows environment: FFmpeg is primarily made for Linux environment not for windows. Some experts developed windows version of ffmpeg.  Some functions are unavailable in windows version. SO I suggest you to use Linux environment.

I thought that only ffmpeg can do everything: FFmpeg is a command line tool to do video related task (only video) such as clipping, video conversion, frame extraction etc. But for the sound, watermarking you have to use other packages too. I will tell about these details later.

php-ffmpeg and ffmpgeg: I was very much confuse between php-ffmpeg and ffmpeg. I after 30 minutes of googling I came to know that ffmpeg-php is extension for php which provide handy functions to convert videos and if you use ffmpeg then you have to use exec() command to execute ffmpeg commands.

Step by step procedure to convert video:

1. Setup Linux system.. forget that windows can do the job!

2. follow instructions and install all required modules. here is comprehensive step by step procedure available http://vexxhost.com/blog/2007/03/03/installing-ffmpeg-ffmpeg-php-mplayer-mencoder-flv2tool-lame-mp3-encoder-libogg-%E2%80%93-the-easy-way/ . if you face any problem then you can ask me.

Remember: Installation order  LAME->FFmpeg->Ruby->FLVTool2

3. Now you have successfully setup environment. Download any example from net and run.

The  best thing I got is videotoolkit you can download it from Here . It saved my day. you can also try it. It’s really worth to try this!

Hope this article will helpful. If you still have any problem then ask.. Happy coding….

Advertisements

8 thoughts on “flv, ffmpeg and PHP: File conversion

  1. Hi Kunali,

    I’ve got in same scenario. I mean I need to convert media type for example mpeg,avi into flv. I’m using JW player to play these videos.

    Now using FFMPEG, i can convert the small video but I could not convert large video(around 100 Mb). I’m experimenting this stuff on window environment

    Do you have any idea how can I convert the large video into FLV using ffmpeg.

    Will things gonna be all right if i use Linux?

    Thanks
    SachIN

  2. @letsnurture Try this on linux. as mentioned above you need these software before proceeding “LAME->FFmpeg->Ruby->FLVTool2” !
    this FFMPEG is made for linux, so work better on linux.
    You will get problem with really large videos on linux environment ( > 1GB ). To resolve this you need to increase SWAP size.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s