Friday, July 6, 2012

Convert images into video in Mac OSX

When people do experiments, it always happened to saving the results into video. However, generating video by using openCV or other tools sometimes will leading to a pain, due to the variance of systems and software.

Therefore, it's always easier to save results as images, then convert them into video. Under Windows OS, you could easily do this with VirtualDub. However, VirtualDub is a Windows Only software. Therefore, under Mac OSX, it is not an option.

Fortunately, VirtualDub is based on ffmpeg, which is designed to be cross-platform. Therefore, we could always use ffmpeg command line to covert images into video.

Suppose all the images are under one directory named: ./samples, and images are named with pattern: img_0000.jpg  img_0001.jpg ... img_5024.jpg and so on. The desired output video name is: test.mp4

After "cd" to the ./samples folder. The following command line will be enough:

ffmpeg -qscale 1 -r 20 -b 9600 -i img_%4d.jpg test.mp4

Here, the img_%4d.jpg section could be modified depend on your own images pattern.

No comments:

Post a Comment

prettify