convert avi to flv using ffmpeg with Thumbnail

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.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.