ttystudio: awesome terminal recorder

terminalThere are several utilities to record your terminal as a gif (like ttyrec). However, most of them have a number of dependencies and the procedure is rather cumbersome. ttystudio is a new tool developed with zero dependencies and support for gif and png output files. Continue reading ttystudio: awesome terminal recorder

clif: record CLI as gif

We explored several tools to record terminal and share them. Most of those use tools like ttyrec or script or follow the same principles. clif is a fresh tool that records console sessions as optimized gif files. It uses web technologies like JS to do the job.

clif depends on child_pty, term.js omggif and phantomjs. child_pty is used to spawn a pseudo terminal which is captured. The captured frames are sent to phantomjs headless browser to render using term.js and screenshot. The gif is created using omggif.

Features

  • Small GIFs
  • High quality (anti-aliased fonts)
  • Rendered with CSS/JS, customizable
  • Real-time parallel rendering
  • Frame aggregation and customizable FPS
  • Support for titles Terminal.app-style
  • Supports Linux and OSX

Installation

To install clif, run:

$ sudo npm install -g clif

Usage

To record a session as out.gif, run:

$ clif out.gif

Type exit to finish the recording.

Available options:

Syntax: clif [options] 
-h, --help      output usage information
-V, --version   output the version number
-c, --cols      cols of the term [90]
-r, --rows      rows of the term [30]
-s, --shell     shell to use [/bin/bash]
-f, --fps       frames per second [8]
-q, --quality   frame quality 1-30 (1 = best|slowest) [5]

On GitHub: clif

Similar software

To install on Ubuntu:

$ sudo apt-get install byzanz

Record, share terminal sessions

terminalThis article is the continuation of the earlier article to record a terminal session as an animated gif image. I found some more services which make it very easy to record your terminal activities and share with friends or for future reference.

Asciinema

Asciinema was inspired by script. Record terminal and share online with friends. You can copy and paste text from the recordings. On the downside, it lets you watch the video online only and if you need more control like embed or delete you need to create an account.

  • To install on Ubuntu
    $ sudo apt-add-repository ppa:zanchey/asciinema
    $ sudo apt-get update
    $ sudo apt-get install asciinema

    To install on other distros check the instructions.

  • Start the recording
    $ asciinema rec
  • Press ^D or type exit to finish recording
  • The app will ask whether to upload the video. Press y. If you don’t you will not have any local copy. Once the upload is complete it will show you the link to the video.
  • If you have an account (which you need to create from the webpage) you can then authenticate and have more control on the video:
    $ asciinema auth

Monitor

Monitor is the newest tool in this list. The recordings are uploaded to commands.com. You can also download the scripts (check the installation step).

  • The easiest way to install on Ubuntu is to install using a captured script
    $ curl commands.io/install-monitor-ubuntu
  • To use Monitor you need to have an account on commands.com.
  • Usage is simaple
    $ monitor {-d} {-h} {-u }
        -d : do not delete /tmp files
        -h : help
        -u : commands.com username

    For example:

    $ monitor -u myusername

Showterm

Showterm is a Ruby tool that follows a similar philosophy as the previous two. There are options to provide the playing speed (slow or fast) in the embeddable link URL.

  • Install on Ubuntu (in case you do not have Ruby). Check for other option here.
    $ curl showterm.io/showterm > ~/bin/showterm
    $ chmod +x ~/bin/showterm
  • Run showterm
    $ showterm
    //or if you haven't installed showterm
    $ bash <(curl record.showterm.io)
  • Type exit ot ^D to end recording. Showterm will upload the video and show you the link to the video.

TermRecord

TermRecord save your recording locally as a sel-contained html file and you can replay it in your browser. It doesn’t have any corresponding web service to upload the recordings. TermRecord comes with several templates for the generated html files. You an play around with them. TermRecord also depends on script, term.js, Ubuntu Mono font and Jinja2.

  • The easiest way to install it is
    $ sudo apt-get install python-pip
    $ sudo pip install TermRecord
    $ TermRecord -o /path_to_output/record.html

PLAYterm

Run ttyrec, record your session and upload the .tty file to PLAYterm. It will play the recording in a beautiful embedded player. Share the link with your friends or embed on your website.

Record terminal session as gif

ttyrec_comp

We mentioned ttyrec in one of our earlier articles. But wouldn’t it be cool if you could record a terminal session as a gif image and share with others? Here’s how to do it with simple cmdline tools.

Requirements

  1. ttyrec
    $ sudo apt-get install ttyrec
  2. tty2gif
    Download the python script from the Bitbucket project or from here.
  3. python-opster (tty2gif dependency)
    $ sudo apt-get install python-opster
  4. convert utility
    $ sudo apt-get install imagemagick

Procedure

  1. Run ttyrec. Start by typing <Ctrl-l> to clear the screen so that the command is also cleared. This is needed to ensure that the tty2gif.py command (in Step 3) isn’t added to your gif image. Continue doing your stuff …
    $ ttyrec
  2. Once done, press <Ctrl-d> to exit ttyrec recording session. You should have a ttyrecord file in the same location.
  3. Copy the tty2gif.py script in the same directory. Convert the ttyrec session to a sequence of gif images:
    $ ./tty2gif.py typing ttyrecord
  4. Now generate the final gif image from the sequence:
    $ convert -delay 25 -loop 0 *.gif terminal.gif

script & ttyrec: record full terminal sessions

terminalIf you want a typescript record of everything that shows up on a terminal session, script & scriptreplay combo is the exact utility you are looking for. A common use is that you can record every activity during a terminal session and the replay it later. Here’s an example:

Start recording with time information in timefile and activity record in recordfile:

$ script -ttimefile recordfile

When invoked, script starts running in the background. Everything you do from here gets recorded. To finish recording press ^D.

To reply the session, use scriptreplay:

$ scriptreplay -ttimefile recordfile

Try it yourself. Amazing, isn’t it?

This can also be done using the more advanced utilities ttyrec and ttyplay. Usage is almost similar but ttyrec does not need any extra file to record times.

Record, run previous commands from history

terminalSuppose you have been working on the terminal for a while and once done you want to edit and save all the commands quickly so that you can re-execute them anytime. There is a neat way to do that.

Make sure history is on. Let’s say you want to edit and save the commands from 500 to 550 in history. Run the following command:

fc 500 550 //fc stands for 'fix command'

This will open the history commands from 500 to 550 in your default editor (mine is vi) as a temporary file. If you want to change the editor or looking for more options, check here. Once you have edited the commands save them in a file. In vi, use :w /path/to/file (absolute path preferred) in command mode. Now when you quit all the commands will execute as a batch script. If you don’t want to run the commands immediately, delete all content (gg followed by dG) and use :wq to exit. This will not remove anything from the previous file you saved, as only the temporary file contents will be deleted.

Record screen with ffmpeg on Linux

ffmpegThere are many screen capture utilities for recording your desktop on Linux:

  • Kazam
  • Istanbul
  • recordMyDesktop
  • SimpleScreenRecorder
  • glc
  • Xvidcap
  • Vokoscreen

Updated the article to use avconv instead of ffmpeg.

  • To record video
    avconv -f x11grab -r 25 -s 1280x720 -i :0.0+0,0 -vcodec libx264 -pre lossless_ultrafast -threads 0 video.mkv
  • To record video + audio
    avconv -f alsa -i pulse -f x11grab -r 25 -s 1280x720 -i :0.0+0,0 -acodec libfaac -vcodec libx264 -pre:0 lossless_ultrafast -threads 0 video.mkv

Here‘s my previous post on how to take screenshots from the cmdline using import.