colinkeenan / silentcast

Create silent mkv screencast and animated gif.
GNU General Public License v3.0
512 stars 22 forks source link

Too many images for the available memory #31

Closed dandv closed 7 years ago

dandv commented 7 years ago

I get this error (+ "Try closing other applications, creating a swap file, or removing unecessary images.") after recording less than a minute of (accidentally) my dual-monitor desktop (1920x1200 +
1920x1080), and trying to create an animated GIF

The available memory is 12.3GB of RAM + 2GB swap.

Why does Silentcast need so much memory? I'm far from an expert on animated GIFs or video, but concatenating PNGs into one animated GIF is a streaming kind of operation; you shouldn't have to load all GIFs in memory? Or is that necessary to figure out the color palette? Can a two-pass approach be used then instead?

colinkeenan commented 7 years ago

I also know very little about how the gifs are actually created. My creation of Silentcast was inspired by the fact that command line tools already existed to do everything needed, but it was hard to figure out all the options that had to go into the commands. Silentcast is a series of bash scripts that generate the necessary commands. It's been quite awhile since I looked at my code, but I know that error was just in reaction to the failure of one of the command-line tools I use. Since it suggests removing unnecessary images, I'm pretty sure it was in response to the failure of Imagemagick's convert command. I didn't actually try to capture whatever error that command may have generated, so it's not guaranteed that lack of memory is really the issue. I was always able to make it work by reducing the number of images though. It seems Imagemagick's convert command does load all the images into memory at once and does the conversion all in memory without using the disk at all.

Reduce the fps or use the image removal tools provided.

dandv commented 7 years ago

It seems Imagemagick's convert command does load all the images into memory at once and does the conversion all in memory without using the disk at all.

Thank you for the explanation. This is unfortunate, and perhaps a dead-end for recording longer screencasts.

Gif Recorder was based on byzanz - perhaps that is a more promising underlying tool to use?

colinkeenan commented 7 years ago

You should try it and comment here to let others know if it can create longer gifs. Also, I checked my code, and I actually provide this error anytime the gif was not successfully created even though requested. It is in the part of the code that wants to delete all the png images, but before doing that, I have it check whether or not anim.gif actually exists, if not, I have it put up this error about memory without actually trying to find out what actually caused the failure.