Source: https://github.com/asciinema/asciinema

Ever tried to follow a tutorial/steps from a video? What if you want to copy the text but the video is blurry, also it can be challenge to type each command by hand and using OCR can be unreliable.

Enter Asciinema: It is a free and open-source solution for recording terminal sessions. Instead of capturing pixels, it captures the raw terminal output. The result is a lightweight .cast file that renders perfectly, requires minimal bandwidth, and allows your viewers to highlight and copy text directly from the player.

Asciinema is available on almost every package manager. Here are the quickest ways to install it depending on your environment:

Alpine Linux apk add asciinema
Ubuntu / Debian sudo apt install asciinema
macOS brew install asciinema
Arch Linux pacman -S asciinema
Python (via pip) pip3 install asciinema
Windows Windows support is currently not available but there have been some workarounds:

Basic Commands Cheat sheet:

Action Command Explanation
Start recording asciinema rec xyz.cast Starts a new shell and records all output to the local xyz.cast file in your current directory
Stop recording exit or Ctrl+D Exits the recording shell and saves the file
Play recording asciinema play xyz.cast Replays your recorded session directly in your terminal
Skip idle time asciinema rec -i 2 xyz.cast When compiling code or waiting for a network response, the -i 2 flag automatically trims that pause down to 2 seconds in the final recording.
Save to a specific location asciinema rec ~/Documents/terminal-recordings/xyz.cast By default, running asciinema rec xyz.cast saves the file directly into whatever directory you are currently working in. To save them somewhere specific, simply provide the absolute or relative path. Note: If you just run asciinema rec without any filename, it saves to a temporary file and will prompt you at the end to either save it locally or upload it directly
Appending to an Existing File asciinema rec –append xyz.cast Accidentally stop your recording too early. Use the –append flag to pick up right where you left off.
Upload recordings to Asciinema’s website asciinema upload xyz.cast This will give you a unique URL to share on the internet. Note: When you upload, Asciinema ignores your local filename and assigns a unique ID to your specific upload. If you upload the same file twice, it simply creates two distinct links.

Here’s an example, try to copy the text from the video: