Convert Video to Images and Back Using FFMPEG
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.
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.
This entry was posted on Wednesday, September 5th, 2007 at 12:28 pm and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.