2009/7/21

convert images to movie using ffmpeg/mencoder

We often have a sequence of images from either
my experiment or from a simulation that I want
to put together into a movie. Since I use linux,
I wanted to do this using free software in linux,
and I wanted to be able to play the
movie in linux.


With mencoder, we can use the vbitrate option to
set the degree of lossy compression. Note that the
default mpeg4 option will add a "DivX" logo to the
movie when playin in windows media player, so we
prefer to use one of the other mpeg4 encoders, such
as msmpeg4 or msmpeg4v2. The commmand line I've used is:

mencoder "mf://*.jpg" -mf fps=10 -o test.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800

We can also use ffmpeg directly to encode the
images files into a movie. If we start with
files name 001.jpg, 002.jpg, ..., we can use:

ffmpeg -r 10 -b 1800 -i %03d.jpg test1800.mp4

Reference:
http://electron.mit.edu/~gsteele/ffmpeg/