We need to make some videos about working with LaTex documents. We have the typescript and timing -files and now we need to convert them into videos to display them in answers. Basically, the way to do that is to make small Gif -animations. Basically if I could record some area in the X window to GIF, then it would be possible over X to make such videos but it is a bit hxckish way and slow. So how can I convert script -processing into Gif -animations?

$ script -t 2> timing   # pastie.org etc to show your working
$ scriptreplay timing   #how to make them into videos on this site?

Example videos

The source is here but created with pay-ware W tool.

enter image description here

Perhaps related

  1. Convert a typescript file to a list of commands (history)

  2. Screencasting in Windows here, what about in *ix?

  • $ apt-cache search screencast gtk-recordmydesktop - Graphical frontend for recordmydesktop screencast tool istanbul - Desktop session recorder producing Ogg Theora video keymon - screencast utility that displays your keyboard and mouse status screenkey - Screencast your keys tested screenkey not like that, testing others. If someone finds the recording thing earlier to me, please, answer.
    – user2362
    Mar 29, 2012 at 0:32
  • 1
    Maybe this would help github.com/nbedos/termtosvg Nov 17, 2019 at 15:56

6 Answers 6


I couldn't get tty2gif to work right with vim. So I hacked together ttygif.


  • This is awesome. I actually found your github while searching for something like this and was debating installing it until I opened up one of my other search tabs and saw you had answered it here. I'm going to install this now.
    – mikeserv
    Jul 11, 2014 at 3:16
  • Great and simple solution. good job!
    – arainone
    Feb 11, 2016 at 0:34

You can playback your typescript capture and encode the corresponding screen region using something like:

ffmpeg -y -f x11grab -s 100x100 -i :0.0+100,100 -pix_fmt rgb24 -r 5 Desktop/capture.gif

-y overwrites the output (most useful when testing)

-f x11grab forces the format to x11grab

-s 100x100 captured video is 100x100

-i :0.0+100,100 top left corner is on server 0 screen 0 on pixel 100,100

-pix_fmt rgb24 forces 24 bpp on input (AFAIK, needed for GIF encoder)

-r 5 5 fps

And Desktop/capture.gif is my captured file.

Just a note: sometimes the ffmpeg that comes from the distro repositories doesn't have all bells and whistles you may want. If that's the case, you'll need to build it yourself (or find a repo that carries a more complete binary). In my example I used a stock ffmpeg from the Ubuntu repos.


Untested: record with ttyrec, and convert with tty2gif.

  • Works for me. Usage is ./tty2gif typing ttyrecord. It will record the terminal window you run it in.
    – Inaimathi
    May 26, 2012 at 18:15
  • @Inaimathi on which system did you test it? I am trying it on OS X: it loads some ImageMagick things but then fires errs, did you get it like this?
    – hhh
    May 13, 2013 at 21:28
  • @hhh - I'm running Debian over here (I think it was Squeeze when I put up that comment). Nope, none of the errors in your paste happened.
    – Inaimathi
    May 13, 2013 at 23:20

most easy way to share typescript is http://shelr.tv/ It uses script or ttyrec as backend and you can puslish your typescript as easy as "shelr push last" :)

  • This is extremely cool! Now just some iFrame-video to GIF -conversion so I could easily use that for sharing things in SO. SO does not support iFrames...
    – user2362
    May 25, 2012 at 19:02
  • Hey, can you see it?! Look Gilles have the tty2gif part, now just use that to convert the video to Gif and provide people a gif image there -- is that possible? It would make the service a killer...
    – user2362
    May 25, 2012 at 19:06
  • I will accept this if it gets the Gif -part, wish I could do a patch to the site :P
    – user2362
    May 25, 2012 at 19:09
  • Hey, guys. Web site is open-source so you can easily add postprocessing for uploaded records! github.com/shelr/shelr.tv/blob/master/app/controllers/…
    – antono
    Jun 1, 2012 at 14:42
  • 3
    shelr.tv is now official closed down.
    – vgoff
    Aug 19, 2015 at 8:14

A alternative for shelr.tv (which was a great option, and may end up being again) is showterm which you can self host, or use as is.

Convert to video as you see fit, this is not a direct to video answer though.


First record terminal session

ttyrec -e "python run_script.py" rec

(here any shell command after -e that needs to be executed and recorded from start to end)

Then convert it to gif

ttygif rec

After that file tty.gif appears in current dir, you can view it through

xdg-open tty.gif

Tools above should be installed by:

sudo apt install ttyrec ttygif

Tested to work on Ubuntu with xterm terminal program.

Also, if you want to convert GIF above to MP4 video do:

ffmpeg -i tty.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -crf 15 tty.mp4

(which needs installing ffmpeg through sudo apt install ffmpeg)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy