Tuesday, June 23, 2009

Video file image capture with ffmpeg

In my work yesterday I had to fix a flash preview option for a website I was doing.
(Cant name the site.) The people (pronounced 'poephol' ) were making the web user who visited their site automatic download loads of video content.

This made the client's website a bit slow, and created lots and lots of bandwith consumption. Anyway. They realized their mistake asked me to send thumbnails of the vidoes.

At first I asked the account manager to send me screenshots of the videos. But this was not going to work, as she pasted it into a word document. Then I thought - "There should be an easier way todo this." - and there is.

1) Install ffmpeg
Debian, Ubuntu:
sudo apt-get install ffmpeg

2) Replace the video and image filenames in the command listed below with your video and image and paste into a terminal.

ffmpeg -y -i video.flv -vframes 1 -ss 00:00:05 -an -vcodec png -f rawvideo framepic.png

3) You may have noticed that the "-ss 00:00:05" indicates to capture the image after 5 seconds. You can change this to the frame you want to capture.

4) After creating the PNG, I used the convert function of ImageMagick to make the file a JPG.

No comments:

Post a Comment