convert avi to flv using ffmpeg with Thumbnail

Video upload functionality is needed in every networking site. I will give best option the create the thumbnail from video file and convert video file to flv format.

convert avi to flv using ffmpeg with Thumbnail

For conversion of video files and creating the thumbnail we need the ffmpeg software need to be installed on server. Here I used the linux server. For installing the FFmpeg I used following article.

http://mysql-apache-php.com/ffmpeg-install.htm

After installing the ffmpeg software in linux you can use the command prompt for converting the video file.

Use the following command for covert the avi or video file to flv format.

#ffmpeg -i VIDEOFILE.aviĀ  -ab 56 -ar 44100 -b 200 -r 15 -s 320×240 -f flv final.flv

If you are using the PHP then you can use following code in your PHP script for converting the video file.


exec("ffmpeg -i VIDEOFILE.aviĀ  -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv final.flv");

//For creating the thumbnail use the following code

exec("ffmpeg -y -i moviefile.avi -vframes 1 -ss 00:01:60 -an -vcodec png -f rawvideo -s 110x90 new.png");

converting the video files to flv format that takes some time. So I recommend not to convert the video file to flv while uploading.

Just create the thumbnail and show to use.

For converting the video file to flv format use the cronjob. Create two or One cronjob setting and daily two or more time through script convert the video files to flv.

Add a Comment

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