|
|
Log in / Subscribe / Register

Asciinema: making movies at the command-line

By Joe Brockmeier
January 12, 2026

In open-source circles there are many situations, such as bug reports, demos, and tutorials, when one might want to provide a play-by-play of a session in one's terminal. The asciinema project provides a set of tools to do just that. Its tools let users record, edit, and share terminal sessions in a text-based format that has quite a few advantages compared to making and sharing videos of terminal sessions. For example, it is easy to use, offers the ability to search text from recorded sessions, and allows users to copy and paste directly from the recording.

History

Marcin Kulik started the project in 2011; it was originally called "ascii.io" and then renamed to asciinema and published to the Python Package Index (PyPI) in 2013. The asciinema project now consists of several parts: a command-line interface (CLI) recorder and player, a web player, the asciicast file format for recordings, the agg utility to create animated GIFs, and the asciinema virtual terminal (avt) used by the project's other components.

Each project has its own license; the asciinema CLI and agg are available under the GPLv3, while the other components are Apache 2.0-licensed. The project's components have undergone a number of changes and rewrites in the past 13 years. Version 3.0 of the CLI, released in September 2025, featured a complete rewrite in Rust, as well as an updated (v3) file format.

The project provides hosting for recordings on asciinema.org for users who don't mind storing them with a third party. The terms of service seem fairly standard for an open-source project that provides content hosting. LWN readers can explore some of the published recordings to get a sense of how others are using the tools. I should note that the project seems to have done a good job keeping recordings online: I have recordings from 2017 that are still available.

The server software is open-source too, of course, for those who prefer to self host. It is written in Elixir and uses the Phoenix Framework; the server is available under the Apache 2.0 license. The most recent server release, v20251114 from November 2025, included new search features and stricter validation of uploaded asciicast files.

Setting the stage

The asciinema CLI is packaged for most popular Linux distributions, but in some cases the available version is outdated. Debian 13, for example, has the 2.4.0 release from October 2023. The project provides Linux binaries for x86-64 with each release, or users can choose to use Rust's cargo to build from source.

After installing the CLI, the asciinema command can be used to record terminal sessions, play them back, or upload the recording to asciinema.org (or another server). For example, this command will record a terminal session to the file lwn.cast:

    $ asciinema rec -i 1 --window-size 80x24 lwn.cast

The use of rec tells asciinema to record, -i 1 optimizes the recording to get rid of any idle moments in the recording longer than one second. That can be fairly useful when recording demos, to get rid of any pauses between composing commands, etc. The --window-size option does what it says on the tin; it sets the terminal window size for the session to the number of columns and rows specified.

As the "how it works" page explains, asciinema captures all terminal output, including window resize events as well as the escape and control sequences in their unfiltered form. By default, asciinema does not record keyboard input (lest it record passwords, for example) but that can also be enabled with the -I option.

The lwn.cast file is plain text; by default, asciinema rec saves a session as an asciicast v3-formatted file, which is a newline-delimited JSON format. Opening the v3 file output in a text editor will show that the first line has metadata about the version of asciinema used, size of the terminal, environment variables, and so forth. The rest of the file includes a line for every element in the event stream—that is, basically each line output to the terminal during the recording session. Each line is a JSON array with the following fields:

    [interval, code, data]

The interval is the time since the previous event, in seconds. The code is the type of event, such as "o" for output, "i" for input, "m" for a marker used for playback or navigation, and so forth. The rest of the line is the data in UTF-8 encoding.

The v2 format, used by the 2.x versions of asciinema, is also still available as an output option with asciinema 3.x in order to share recordings with users who have not upgraded. Or one can use the "asciinema convert" option to take a v3 recording and output it as v2. The CLI also offers a raw output format that includes the raw terminal output without timing or metadata and a plain-text format that does not include control sequences or colors in the output.

Performance

I've found asciinema particularly useful in the past for recording demos and sharing them as embeds for blog posts or to play back during talks. Fumbling around on the keyboard during a talk is not my favorite thing to do, and if something can go wrong during a live demo, it probably will. Prerecording a session's demos not only makes for a smoother presentation; it allows a speaker to share the demos for the audience to review later. An asciinema recording can be a helpful supplement to provide along with slides and video of a talk.

The "asciinema play filename.cast" command plays a session recording back in the terminal. The terminal-based player is a bit limited in terms of controls; it only supports pausing with the "Space" key, stepping through the recording one frame at a time with the "." key, or advancing to a marker by pressing "]". A marker is similar to a chapter on a DVD or a track on a CD.

The web-based player is written in JavaScript and Rust (compiled to WebAssembly). The project has a quick start that demonstrates how to embed the player on a web page without needing to host a separate asciinema server. If a recording is hosted on asciinema.org or another server, it can be embedded in a web page with a "<script>" tag. The web version is more full-featured than the CLI player; it allows rewinding and fast-forwarding playback, stepping backward and forward through a recording, and more. It is also possible to link directly to a specific time in a video by appending something like "?t=M:SS", where M would be the minutes and SS would be the seconds.

Users can copy and paste from the CLI or web-based players, which can make asciinema recordings quite useful for tutorials or otherwise sharing with coworkers or collaborators. Showing a coworker how to do something at the terminal is easy as pie when they can watch a realtime recording of it being done and pause to copy the commands to their own terminal. Likewise, it may be a useful format to include with bug reports and the like; why settle for a log file when it's possible to include a detailed session that shows exactly what happens when a bug is encountered?

The 3.0 release added two new commands for live streaming terminal sessions, "asciinema stream" and "asciinema session". The "stream" command publishes a live stream either through a built-in HTTP server, or by feeding the stream through an asciinema server as a relay. The "session" command allows a user to live stream a session and record it to a file at the same time. That can be ideal if one has to do a live demo for coworkers and save it for posterity as well.

Prior versions of asciinema made it too easy to accidentally upload recordings, but that is no longer the case. Users must specify a filename when recording a session, and uploading is a manual step that requires the user to pick a server to upload to. To upload a recording, use "asciinema upload recording.cast". Note that the project allows users to upload recordings that are not linked to an account; those sessions are deleted after seven days. Recordings associated with an account are preserved indefinitely. Here is a basic demo created with asciinema that shows its ability to capture rich terminal output:

Assuming one has JavaScript enabled, the embedded player should show up above this sentence. Note that this demonstrates another feature of asciinema; it allows setting a terminal theme for playback that is different from the terminal settings used to record a session. I've chosen the "Monokai" theme here so that the player will stand out more for readers who have the site set to dark mode.

The project provides Linux container images for those who would like to self host the asciinema server using Docker, Podman, or Kubernetes. The quick start instructions include a configuration to run all of its services with Docker Compose. There is also a high-level explanation of the configuration for those who want to understand what's going on under the hood; it may be helpful for those who wish to try running the services with a different container manager or without one entirely.

The project is largely a one-person show; there are a number of contributors to the various components, but Kulik has thousands of commits to each repository, while those of other contributors tend to number in the single digits. Kulik has kept the project running pretty well for nearly 15 years; it is mature, updates come out regularly, and he seems to care about maintaining backward compatibility for asciinema's users. There is a Discourse forum for users to discuss the project, and the project is on the fediverse for those who would like to keep up with updates.



to post comments

More complicated than it sounds

Posted Jan 12, 2026 18:04 UTC (Mon) by iabervon (subscriber, #722) [Link] (4 responses)

It probably says something about me or my interests that my immediate reaction is that I want to record a screen session running programs that were started in a different terminal that disagrees with my current one over the number of columns occupied by some of the characters being displayed.

For that matter, I want to know what happens if you put an xterm in that weird mode I've never used intentionally.

More complicated than it sounds

Posted Jan 13, 2026 16:56 UTC (Tue) by jengelh (subscriber, #33263) [Link] (3 responses)

>I want to record a screen session running programs that were started in a different terminal that disagrees with my current one over the number of columns occupied

GNU Screen has you covered (kind of): if any Screen window moves from one to multiple attached viewers, the terminal size of the first one wins. If the second/third/etc. viewer's space is larger than the first, the area will be properly delineated with dashes and all is fine. The problems only start if the second viewer has smaller space than the first. The problem is the same as having an RDP client window being smaller than the desktop it has to portray, but for text mode, there's extra wonky because you cannot scale-and-reproject text like you can with graphics.

>what happens if you put an xterm in that weird mode I've never used intentionally

screen size (or changes thereof) isn't all that weird. Weird mode is activated when you `echo -en '\e(0'`!

More complicated than it sounds

Posted Jan 13, 2026 17:33 UTC (Tue) by iabervon (subscriber, #722) [Link] (2 responses)

The case I was thinking of with columns is that xterm and Mac terminals disagree as to whether emoji are one column wide or two, so, if you've got some emoji on a line, they'll disagree as to which character is in which column later on the line.

Changing the number of rows and number of columns is, in fact, not weird at all, aside from the time I maximized an iconified xterm and got something with 1900-character-long lines in a 1x2 font, which may test some limits in recording and playback.

More complicated than it sounds

Posted Jan 13, 2026 18:33 UTC (Tue) by jengelh (subscriber, #33263) [Link] (1 responses)

>xterm and Mac terminals disagree as to whether emoji are one column wide or two

ICU likely has an answer for that, but since xterm isn't using libicu, I would not be surprised if xterm does not have the contemporary picture of how things should be. That said, when I see https://metacpan.org/pod/Unicode::EastAsianWidth referring to U+2010 as "ambiguous-width", I'm losing all hope that there's one true answer for terminal implementations.

Perhaps we should just stop using emojis and anything exceeding cp437 altogether: I don't see the point of why `systemctl status ...` has to emit a U+25CF when U+2022 or an asterisk would have sufficed (because /usr/share/kbd/unimaps/cp437.uni traditionally mapped only that).

More complicated than it sounds

Posted Jan 15, 2026 8:59 UTC (Thu) by taladar (subscriber, #68407) [Link]

Using emojis is a good canary in the coal mine for western developers to notice when they broke support for other languages that need Unicode in their every day text.

Cut and paste!!

Posted Jan 13, 2026 0:36 UTC (Tue) by jmalcolm (subscriber, #8876) [Link] (2 responses)

The ability to cut-and-paste sounds huge. This would be so great for tutorials or quick start guides. I can think of so many GitHub pages where I would love to have one of these sessions pasted alongside the README.

Cut and paste!!

Posted Jan 13, 2026 8:15 UTC (Tue) by gedeon (subscriber, #21965) [Link] (1 responses)

Huge indeed... if you realize it ;-). I have known the project for years and already watched a few recordings, but never realized until reading this article that you could copy and paste the content. I always wrongly assumed it was just taking advantage of the text nature to compress better but was like a video player otherwise. Silly me. :-(

Cut and paste!!

Posted Jan 13, 2026 8:55 UTC (Tue) by claudex (subscriber, #92510) [Link]

For your defense, not everybody use the JavaScript version, they are lot of places (presentation, github readme...) where the gif/video version is shown, so you can't copy-paste.

Recording terminals 24x7

Posted Jan 13, 2026 14:08 UTC (Tue) by kxxt (subscriber, #172895) [Link]

I once tried to record my terminals 24x7 to save them for memories (and potentially for AI training). I implemented a eBPF based recorder that saves zstd compressed asciicast-v2 format.

But unfortunately it doesn't work on CachyOS's optimized kernel that inlined pty_write() so I stopped doing that.
Here's the MVP project, BTW: https://github.com/kxxt/ttyrecall/

The project is not actively maintained anymore but hopefully might provide some ideas to those that would like to develop alternatives.

Playback with audio?

Posted Jan 13, 2026 19:42 UTC (Tue) by JonathanMatthews (subscriber, #179908) [Link] (3 responses)

It’d be lovely to be able to use asciinema to record a terminal session whilst (separately but simultaneously) also recording a voiceover to explain what’s being done.

Has anyone seen this being done? The audio recording seems like it would be pretty simple - just trigger a discrete recorder and trim any unnecessary preamble after the fact. The part I’ve not seen working in anger is the sync’d playback; either in a web browser, or by combining the audio and terminal into a single video file.

Playback with audio?

Posted Jan 13, 2026 19:47 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

Record in tmux, add a short split at the top or bottom and have it stream text-to-speech rendering of your commentary :D .

Playback with audio?

Posted Jan 13, 2026 20:48 UTC (Tue) by jzb (editor, #7867) [Link] (1 responses)

If you host a cast using the asciinema web server, there is an option to add an audio URL that will be sync'ed with playback of the terminal recording. If there's a way to do this with the CLI player, I have not found it.

Playback with audio?

Posted Jan 13, 2026 21:07 UTC (Tue) by JonathanMatthews (subscriber, #179908) [Link]

Oh, thank you for prompting me to recheck it’s built-in capabilities!

The JS API allows for an audio stream URL parameter: https://docs.asciinema.org/manual/player/options/#audiourl. This achieves the main thing I wanted to do - narrating a demo on a webpage :-)

Great peace of software

Posted Jan 20, 2026 15:22 UTC (Tue) by jsakkine (subscriber, #80603) [Link]

Have been using this for years, good stuff. And the best possible cheat code for conference demos ;-)


Copyright © 2026, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds