CasTTY is a program similar to ttyrec and
asciinema that makes it easy to
create audio-enabled, terminal-based screencasts for publication on webpages.
It was originally a fork of
ttyrec, but has since effectively been
rewritten from scratch.
There may be bugs. Feel free to contribute patches or file an issue!
I've tested CasTTY on macOS Sierra and Linux. It should work on other systems, but if not, please feel free to send a patch. It probably can't record if you don't have a microphone, unless you have some weird audio mixing setup.
It depends on libsoundio. Ubuntu 16.04 seems to ship a
broken version of
libsoundio that depends on a version of JACK that doesn't
work. This is fixed in the libsoundio repo,
but you will have to build it yourself.
CasTTY also depends on LAME (and in particular,
libmp3lame) for on-the-fly MP3 encoding. It is possible to compile without LAME
(and therefore without mp3 support) by modifying
config.mk to contain
WITH_LAME = no.
There are no UI build dependencies because I find that idea a little silly.
To build, simply run
make once dependencies have been installed. If they were
installed to a location other than
/usr/local/, you will have to edit the
usage: castty [-acdelrt] [out.json] -a <outfile> Output audio to <outfile>. Must be specified with -d. -c <cols> Use <cols> columns in the recorded shell session. -D <outfile> Send debugging information into <outfile> -d <device> Use audio device <device> for input. -e <cmd> Execute <cmd> from the recorded shell session. -l List available audio input devices and exit. -m Encode audio to mp3 before writing. -r <rows> Use <rows> rows in the recorded shell session. -t <title> Title of the cast. [out.json] Optional output filename of recorded events. If not specified, a file "events.json" will be created.
To list usable input devices for recording, just run
castty -l. Output will
look something like this:
Available input devices: 0: Built-in Microphone 44100Hz castty -d 'AppleHDAEngineInput:1B,0,1,0:1' -a audio.f32le
-d 'AppleHDAEngineInput:1B,0,1,0:1' argument can be pasted directly to
CasTTY to choose that device for recording. The audio format and sample rate
CasTTY will use is also provided.
CasTTY supports MP3 output by default, but other encodings may be desirable.
-m flag, CasTTY outputs interleaved PCM audio. (CasTTY upgrades
mono audio to stereo.)
Utilities like sox may be used to convert the audio into more useful formats for web publication.
% sox -D -r 44100 -e signed -b 16 -c 2 -L audio.raw audio.wav
By default, CasTTY does not record audio and sends its terminal event output
to a file called
CasTTY contains a runtime command interface. Commands are entered with the
Control-a), followed by the command character.
Currently supported commands are:
^a: Send a literal
^ato the recorded session.
a: Send a literal
^ato the recorded session.
m: Mute or unmute the recording. Recording will continue, but without any audio until unmuted.
p: Pause or unpause the recording. Neither terminal nor audio will be recorded during the paused period. When unpausing, CasTTY requests the screen to be redrawn. This may cause your terminal buffer to clear.
CasTTY does support window resizing. However, because the size of the player is automatically calculated based on the size of the original window, the recorded window size can only ever be as large or smaller than the original window size.
CasTTY supports UTF-8 input.
CasTTY outputs in asciicast v1 format. Its output files should be compatible with the asciinema player (though that player does not support audio).
ui directory of the repository is a self-contained implementation of a
CasTTY player. Utilities used include:
Licenses for all these utilities can be found in their respective repositories and in the LICENSE file in this repository.
To create a cast, simply modify
ui/index.html to point to the correct audio
events.js output from