I recently needed to record my screen and output it to a .gif file. I know it’s a weird thing to do – compared to webm video for example, gifs are way bigger in size, way lower quality and don’t have sound. So.. why?
Well, mostly because in most cases GIFs are treated as images(because they technically are) instead of videos. If for example you need to put a very short screenrecording inline in a markdown document on GitHub, you can’t really do it with a video file. You can link to it, but not embed it directly in the document. But because GIFs are essentially images, you can place them inline just like any other image.
One way to handle that is to use a screencasting program like, say, ‘Kazam’ to record your screen, to a video file, and then use some kind of convertion tool to convert the .avi or .webm to .gif . If you need to do a bunch of recordings, that gets really old really quickly.
So I started looking for tools that record your screen and output GIF files automatically. Peek was one that grabbed my attention, but didn’t quite work on my environment for some reason(probably my non-conventional window manager?) Then I found some other similar stuff, none of which worked the way I wanted them to.
The solution:
Clone the repo, copy the gifcast file in your $PATH, then just execute ‘gifcast’ from a terminal window. You’ll be prompted to select an area, after you do that, the recording starts. You can stop it by pressing ‘q’ in the terminal window you started it with. The .gif output is in ~/Videos/gifcast_%DATE%.gif. There is a temp .avi file in /tmp/ in case you need it.
Keep in mind that if the recording gets long, it can take some time to convert it to GIF after pressing ‘q’, be patient and don’t close the terminal window until it’s finished.