Friday, December 24th, 2010, 4:55 pm
Making Videos With Animate
few weeks ago I wrote about turning image sequences into real videos using The GIMP, which is more than just an image editor and my favourite tool for simple videos. But I sought to automate more of the process, so I wrote some Octave code to number the sequence of figures, save them all in raster space under a newly-created directory, and then pass them all using a UNIX-style system call to animate, which is a utility I’ve used for this purpose since 2004. Animate is built in a way that makes it compatible with just about any environment sitting on top of X Server. It allows videos to be saved in so many different formats, including GIF, which makes it easy to open in a lot of programs including Web browsers. Animate also has PDF as an output option — one where frames are separated by pages. This makes it a very powerful tool, which would have been even more powerful had it been possible to save the resultant video from the command line (no such option exists based on the man page). As it stands, making it scriptable is a case of “close, but no cigar” (little human intervention needed). One of this blog’s readers, Twitter, has suggested some other programs that can turn sequences of images into videos without any GUI obstruction. Yes, GUI is trouble in these cases.
The bottom line is, there are many tools for Linux/UNIX which make video composition rather simple and even scriptable (necessary when handling many sets, or sets of 3-D slices). For turning videos into a set of images I use Avidemux. It’s small and simple.
As some example output, here is a video showing how a rough and incorrect estimate deals with cardiac cycle. The crosses represent radii of best circle fit to the surrounding points. There is no constraint in place yet to ensure diffeomorphism.
Here is a more properly placed (at least initially) set of landmark points adjusting to fit the heart’s walls.
The figures where values are plotted as a function of frame # basically say how much the points move further away from the centre and whether they move clockwise or counterclockwise. These figures correspond to the two videos, where the latter (*tracked.png) belong to the second video.