Hi! If you work with computer vision maybe you have had the need to generate a video from a sequence of images, in order to get a dynamic view of your results. I'm going to show you a very easy way to do that with a simple command, using ffmpeg :) .
(Click the photo for better resolution in Picasa Photostream) |
So, let's suppose that your images are named "frame-0.png, frame-1.png, frame 2.png" and so on.. The first thing to do is to get the generic name of the images by replacing the image sequence number by "%d". That will leave us with the name "frame-%d.png". Now open up a terminal and make your way into the folder where you have your pictures and just enter the following command:
ffmpeg -qscale 1 -r 25 -i frame-%d.png movie.avi
And in a short time (depends on the amount of images) you will have a video file with a framerate of 25 fps named "movie.avi". The name can be customized by changing the last parameter of the command. The "-qscale" parameter defines the quality, being 1 the best quality and 31 the worst. The parameter "-r" defines the framerate which, as already referred, in this example is 25. The option "-i" specifies the input files. There are lots and lots of other options but this is supposed to be only an example to get you going. If you need to see more options just open the terminal (or google) and write:
man ffmpeg
Hope it's useful for you. :)
Did you find this post helpful? Do you wish to contribute to other projects regarding computer science, electronics, robotics or mechatronics that will be posted in this blog? If you wish to do so, you can donate via paypal using the button below. Thanks! :)
0 Comments: