In addition to the memory (and slowness) problem, this question combines two other issues that I've thought about before. The problems only arise if the gif files are animations, but the solution could be similar:
- When importing GIF animation, how to find the correct list of “DisplayDurations”?
- Does Mathematica support variable frame rate for any video format, in analogue of GIF-style “DisplayDurations”?
In the second post, I answered my own question by writing an export function that assembles the movie from a sequence of frames, but outside of Mathematica. This by itself could already help with the memory problem:
Assuming you're on Mac OS X and you manage to get all the frames into a Mathematica list called
images, you could use the function
exportMov I defined in my answer
On that page I also have a link to a Python utility that can be used to achieve the same thing from the command line completely without Mathematica and relying only on built in Mac OS X functionality - but that's off-topic for this forum.
If you want to use an external tool, you may want to look at this page where I describe how to use
One more thing that could make or break any attempt to even import the images into Mathematica is this (your question already does this, but I think it bears repeating): Always end your
Import statement with a semicolon to suppress the display of the image frames. Otherwise, with a large number of images, the notebook interface will be busy drawing them for what feels like an eternity.