Terminal recording for GIF screencasts using toughtty

Ter­mi­nal record­ing soft­ware isn’t too friend­ly to con­tent pro­duc­ers, I’ve found. But there’s a Node.js imple­men­ta­tion of a ter­mi­nal recorder called ttys­tu­dio that showed promise even if it had not been touched for two years. I didn’t have to deal with weird sys­tem depen­den­cies and con­fig­u­ra­tion depend­ing on my dis­tro. I just ran npm i and went to town.

ttystudio was real­ly cool but I wasn’t real­ly agree­ing with the whole idea of record­ing the ter­mi­nal in real-time. I want­ed to have time to think about what I was typ­ing, and then have the out­put GIF not show any disk-space-hog­ging paus­es relat­ed to my doubt, inde­ci­sion or inter­mit­tent typ­ing accu­ra­cy.

After fork­ing and tak­ing sev­er­al shame­less­ly sub­jec­tive cre­ative lib­er­ties I end­ed up with this com­par­i­son. The first GIF is by ttystudio, and the sec­ond is by my ver­sion, toughtty*

ttystudio’s GIF weighs in at 84 frames and 3805 bytes, against toughtty’s 38 frames and 2980 bytes for the same ses­sion. Also, if I sat and spent 15 min­utes typ­ing that echo com­mand, the met­rics for toughtty’s GIF would not change, where­as ttystudio’s GIF would have grown beyond a rea­son­able size for use on the web. The only dif­fer­ence is that ttystudio cap­tures frames over time, where­as toughtty cap­tures frames in response to changes.

Throw­ing out record­ing in real-time does come with a caveat; You can’t add a pause in your GIF by just sit­ting back and wait­ing a moment. Want paus­es added auto­mat­i­cal­ly with­out real-time record­ing? Well, toughtty. I added a --padding option that lets the user add padding frames one, two or ten at a time to allow the view­er to review key con­tent.

I eat my own dog­food, so you can see GIFs pro­duced by toughtty on my Aloe arti­cle. If you want to record your ter­mi­nal ses­sions and save them as GIFs, check out the README in the toughtty source for instal­la­tion and usage instruc­tions.

*(I can’t believe that name wasn’t tak­en!)

Do NOT follow this link or you will be banned from the site!