Convert Video to Images and Back Using FFMPEG

September 5th, 2007 by Andrew Wells

I’ve used this technique to get lightning shots that I’ve gotten from my video camera. This will help you get static pictures from any video clip. You can also manipulate the images and convert them back into a video clip!

I am running Ubuntu Linux, but these commands may also work with the Windows version of FFMPEG. Use at your own risk.

First, lets make a directory to put them in since we are all organized.

mkdir ffmpeg_temp

Now, let’s run the command to make the pictures from a video. This next command will take the video, video.mpg in the current directory, convert it into images, and place them into the directory created with the above command. If you want a frame rate other than 1 frame /sec, modify the -r switch.

ffmpeg -i video.mpg -r 1 -f image2 ffmpeg_temp/%05d.png

You now have all the images in the ffmpeg_temp directory. Yay!

Now what if you want to convert it back? Just run the command below. If you changed the directory name that was specified above, make sure that you modify the command accordingly.

ffmpeg -i ffmpeg_temp/%05d.png -b 512 video2.mpg

This post was a variation on my tutorial on creating a time lapse video using FFMPEG.

One Response to “Convert Video to Images and Back Using FFMPEG”

  1. Let Search Engines Help When Out of Blogging Ideas | Pr0gr4mm3r Says:

    [...] up with that set of keywords. I had no blog entry that explained how to convert a video to images, but I do now, because I saw that the search engines were already sending people over here that wanted that [...]

Leave a Reply