
Asciinema – Record and share terminal sessions - tomerbd
https://asciinema.org/
======
signa11
'script' also does something similar, and is one of the lesser known commands.

from the man page:

    
    
           script  makes a typescript of everything displayed on your ter‐
           minal.  It is useful for students who need a hardcopy record of
           an  interactive session as proof of an assignment, as the type‐
           script file can be printed out later with lpr(1).

~~~
ilikejam
script unfortunately messes with SIGWINCH for terminal resizes - asciinema
seems to work better in that case.

~~~
billconan
can script record vim editing session?

~~~
SEJeff
Not well, but asciinema does it wonderfully.

e.g.: [https://asciinema.org/a/188770](https://asciinema.org/a/188770)

------
awalton
Pretty favorable experience with working with this tool at $dayjob, all but
the compiling of it. Luckily they release precompiled js/css files that are
fairly straightforward to consume.

The downside is that the recording format is a bit of a mess and that you end
up having to hand tweak things a lot in order to make the recordings pretty. I
wish the tool had more in the way of cleaning up its own recordings so that
wasn't necessary. There's a small cottage industry of tools on github around
this, but none of them were exceptional enough to warrant a note here.

------
wildduck
Don't know if I want to a script that records my terminal session and upload
the recording to an external server. Is there a way to keep the recording
local?

~~~
sirn
asciinema is open-source and the file format is publicly documented
(asciicast)[1]. You can run `asciinema rec filename.json` to save the file
locally and self-host it with asciinema-player[2]. Alternatively, there's also
asciicast2gif[3] that converts asciicast json to GIF image.

[1]:
[https://github.com/asciinema/asciinema/blob/master/doc/ascii...](https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v2.md)

[2]: [https://github.com/asciinema/asciinema-
player](https://github.com/asciinema/asciinema-player)

[3]:
[https://github.com/asciinema/asciicast2gif](https://github.com/asciinema/asciicast2gif)

~~~
heinrichhartman
Has anyone experiences with asciicast2gif?

On the surface this looks just like what's needed to make this work for me: I
like the recording tools, but don't want to be forced to embed a player from a
third party service.

Looks like asciinema2gif relies on PhantomJs which brings withit an entire
browser and is also no longer maintained. This looks very bloaty for a tool
that should convert terminal input to a gif file.

Is it working relieably and reasonably fast?

~~~
akavel
I've written an incomplete ad-hoc renderer in Go:
[https://github.com/akavel/asciinema2gif](https://github.com/akavel/asciinema2gif)
— it worked in one case where I needed it personally, but it's missing support
for _a lot_ of escape sequences, so it most probably Won't Work For You As Is.
But you're free (as in AGPL) and welcome to play with it if you like!

------
lvh
Asciinema is great and a joy to use, but one of the coolest things about how
Asciinema is made is that the web player implements a virtual terminal
emulator in Clojure:

[https://github.com/asciinema/vt/blob/master/src/asciinema/vt...](https://github.com/asciinema/vt/blob/master/src/asciinema/vt.cljc)

It's cljc, which means it runs on both JVM and in JS. I have no idea if they
actually use the JVM bit.

~~~
sickill
The JVM part is not in practical use, but it was just to easy to use cljc to
not do it this way

------
dugo
I have automated a few installations of historical operating systems in
qemu/bochs with the help of travis-ci. Due to all the ANSI output the job logs
are unreadable. To see what's going on in the emulator I use an asciinema
rec/asciinema upload in the build scripts. This helped me out a lot.

------
makotoNagano
There are only 2 ways of pronouncing that, "Ascii enema" or "Ass cinema", both
butt related... bit unfortunate.

~~~
OskarS
It's "ask-inema" in my head.

~~~
magic_beans
That's the obvious answer. This is a name that looks great when reading, but
sounds awful when spoken.

------
dang
Two threads from 2018:
[https://news.ycombinator.com/item?id=17048922](https://news.ycombinator.com/item?id=17048922)

[https://news.ycombinator.com/item?id=16409429](https://news.ycombinator.com/item?id=16409429)

Related from 2016:
[https://news.ycombinator.com/item?id=12090020](https://news.ycombinator.com/item?id=12090020)

Three from 2015:
[https://news.ycombinator.com/item?id=10398635](https://news.ycombinator.com/item?id=10398635)

[https://news.ycombinator.com/item?id=9753537](https://news.ycombinator.com/item?id=9753537)

[https://news.ycombinator.com/item?id=9072218](https://news.ycombinator.com/item?id=9072218)

First posted in 2013, getting a single dismissive response:
[https://news.ycombinator.com/item?id=6556106](https://news.ycombinator.com/item?id=6556106)

Lots more with few comments:
[https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...](https://hn.algolia.com/?dateRange=all&page=0&prefix=true&query=Asciinema%20comments%3E0&sort=byDate&type=story)

------
eeZah7Ux
If you feel like using asciinema or similar on your readme - _please_ consider
using plain text instead.

This fancy players:

\- are unfriendly to visually impaired people

\- are unfriendly to the many people with low bandwith in the global south

\- require you to watch the play instead of scanning through text with your
eyes

\- cannot be searched for text strings easily

\- cannot be easily used in a terminal or without a browser

~~~
awalton
> please consider using plain text instead

You do understand this is a false dichotomy? You can have both. Some people
would rather watch a video and follow along, whereas others get more out of
reading text... and both fit neatly on a page right next to one another.

~~~
StavrosK
For double the effort, which not many people go to.

~~~
masukomi
sure, if you're going to be lazy and only do one do text. HOWEVER advocating
for the lazy path amongst fellow practitioners is not a great strategy to
promote quality output.

Documentation is hard. Good documentation is harder. There are many occasions
where video and video-like things are good for getting a feel for something
and just plain text is good for reference. We shouldn't be saying "just use
text because you probably won't bother doing everything you should". We should
be saying "Hey, video, still images, and text all combine to make great
documentation and help people to understand and use your tool / product." They
take time, but we should care about our users, and thus we should take the
time to support them.

------
ckdarby
Love the tool there are a couple of downsides:

1) Doesn't work with powerpoint if you have to use that

2) There's no "pause" point. A lot of time you want to have the command play
to a certain point but then cause until you click "next" so that you can
explain things to the audience before continuing on.

3) End up having to fiddle a lot with the JSON so the timing feels decent vs
me copy/pasting into it and hitting enter.

~~~
truculent
I have used ascii2gif to use asciinema in powerpoints, documents etc,
successfully. Would this be helpful to you?

------
sdan
Are there any alternatives (just want to see alternatives to find which is
best for my use).

Either way, looks nice!

Although a bit irrelevant, like the gradient!

~~~
nbe
I wrote termtosvg as an alternative [1]. It's a python program that records a
shell session as a standalone SVG animation. Animations produced by termtosvg
can be embedded in Markdown files or HTML pages.

[1] [https://github.com/nbedos/termtosvg](https://github.com/nbedos/termtosvg)

~~~
csdvrx
That's great! I love the approach: a standalone ouput in a standard format.

Do you think you could also add support for ttyrec input?

This would allow converting existing ttyrecs and have a a full suite of tools
creating all the options ready to upload between 1) standard text format
record, 2) regular animated gif, 3) svg when saving space is important (while
gaining zoom abilities as well!)

~~~
nbe
It's a good idea. I don't have much time for termtosvg these days so I can't
promise it'll get implemented but I've opened an issue to remember it [1].

[1]
[https://github.com/nbedos/termtosvg/issues/108](https://github.com/nbedos/termtosvg/issues/108)

------
dcchambers
I've been using this for years and have been really happy with it. IMO it
beats other video/gif recordings because of the way it stores the data files.
It records all input and output individually, so you can copy-paste from the
recordings. I think it would be invaluable in a classroom setting.

------
dankamongmen
if you're looking for something interesting to record, try notcurses, 0.4.0
released last week.
[https://www.youtube.com/watch?v=eEv2YRyiEVM](https://www.youtube.com/watch?v=eEv2YRyiEVM)

------
forrestthewoods
I tried using asciienema for a blog post. I forget exactly why I gave up on
it. Something about it frustrated me and didn’t work right.

I ended up using OBS to make a screen capture. Now I have an MP4 that plays in
a vanilla html5 video tag and will work forever.

~~~
SifJar
One killer feature you get with asciinema & not with an MP4 is that people
watching it can copy & paste from your recording. So they don't have to type
out the same command you typed, they can just copy it into their terminal
directly

~~~
awalton
Not what I'd consider a killer feature, but it's definitely one of the
advantages.

Now, what is killer is that the recording is just a text file, so I can edit
it and check it in to my source control system, rather than having to mangle
some screen recording environment and check in a binary blob that's
hard/impossible to edit in the future.

It's also pretty universally guaranteed to work since it doesn't demand much
of the browser as far as weird javascript features go, and means I can deliver
a whole screen recording in the fraction of the size of an MP4 file. It's
screen resolution agnostic, making it more functional for a wider class of
users than a video. I also don't have to ship a different version of the
recording if I want a high contrast version for accessibility reasons.

So, yeah, plenty of reasons to use asciinema over a conventional screen
recording.

------
eatonphil
My team wrote our own implementation with a similar API to get around
Asciinema's weird support for React [0]. We've been using it in our web
application to play back historic terminal sessions recorded by our agent.
Unfortunately it hasn't been split out from the main application code yet.
Open sourcing it is on the list.

[0] [https://github.com/asciinema/asciinema-
player/issues/72](https://github.com/asciinema/asciinema-player/issues/72)

~~~
kreetx
How do you mean with the "weird support"? I could read the code of course, but
essentially, what do you mean? :)

~~~
samatman
The first two posts of the linked issue should satisfy your curiousity.

------
nickcox
I love this tool.

For people who want to render asciicast to SVG, I can highly recommend svg-
term-cli[1].

[1] [https://github.com/marionebl/svg-term-
cli/](https://github.com/marionebl/svg-term-cli/)

------
fooblitzky
When I saw the name I thought of towel.blinkenlights.nl

------
libso
And the site is down.

------
tu7001
I've used IT few times, it's cool.

------
nicofo
Welcome to the internet, but thanks!

------
csdvrx
Let me be the devil advocate: why not use ttyrec + seq2gif instead? Or check
[https://intoli.com/blog/terminal-
recorders/](https://intoli.com/blog/terminal-recorders/) if you don't like my
recommendation

ttyrec is a standard format that most people and tools understand.

And if you want something fancy that asciinema output, you can use seq2gif
which support all the bells n whistles asciinema does, while allowing you to
also upload the ttyrec file.

However, I would suggest not using unicode or Ansi color in your recordings.

You want to demo a feature, not show your cool terminal or the amazing gif you
made. The gif is just a byproduct. Keeping to plain text as much as possible
makes your recording available to people using text terminals and Braille
screen readers.

My most recent example:
[https://github.com/csdvrx/pg_csdvrx/raw/master/pg_csdvrx.tty...](https://github.com/csdvrx/pg_csdvrx/raw/master/pg_csdvrx.ttyrecord)
and
[https://github.com/csdvrx/pg_csdvrx/raw/master/pg_csdvrx.gif](https://github.com/csdvrx/pg_csdvrx/raw/master/pg_csdvrx.gif)

(in case you wonder why I'm doing a cat /dev/random into a live postgres
database block file, this is to show how I can recover the database content
from the raw directory. Kids, don't try this at home. Don't try it at your
parents work on their production database either. In fact, just don't do that,
it is only for when your database ends up in /lost+found)

~~~
lol768
>Let me be the devil advocate: why not use ttyrec + seq2gif instead?

GIFs look poor - they don't capture colours well. They're not accessible. They
don't zoom. Copy and paste doesn't work.

>And if you want something fancy that asciinema output, you can use seq2gif
which support all the bell n whites asciinema does, while allowing you to also
upload the ttyrec file.

Unless I'm missing something obvious (possible!), seq2gif makes a GIF file.
How does this "support all the bell n whites asciinema does"?

>However, I would suggest not using unicode or Ansi color in your recordings.

It's 2019, there's no excuse for these (and emoji!) not working fine.

>You want to demo a feature, not show your cool terminal or the amazing gif
you made. The gif is just a byproduct. Keeping to plain text as much as
possible makes your recording available to people using text terminals and
Braille screen readers.

Agreed - how does seq2gif fit in with this? Or are you saying the ttyrecord
files are more accessible?

It looks like a binary format, I have nothing on my system that can read it. I
_do_ have a web browser, though.

~~~
csdvrx
> Or are you saying the ttyrecord files are more accessible?

I do. You can edit them like if you made a typo. They are common, so there's
an ecosystem of tools if you don't like raw edits.

Next to that, asciinema looks like reeinventing the wheel, except it's no
longer round, so it requires special tools and roads now. But what's a few
extra dependencies? It looks better and it's new!

> I have nothing on my system that can read it. I do have a web browser,
> though.

In general, I prefer a standard format supported by many free software tools
that lets me create a file in another standard format that I can put on my
website without requiring various other dependencies, like javascripts.
Especially if I can pacman / apt-get install the tools.

> seq2gif makes a GIF file. How does this "support all

asciinema #1 use case is to show a recording with color, unicode, etc. I think
that's a bad idea for accessibility. You want to show features, not look cool.
Still seq2gif gives you that, and the output in a standard format. You can
replay the original in a normal term, copy paste etc.

If you think copy & paste from the browser showing an animated replay of the
terminal is an important use case #2, huh, we have different use cases, but I
don't see how it couldn't be done as another target (seq2something_else, maybe
seq2svg?) from a well known and accessible format like ttyrec

~~~
faho
>In general, I prefer a standard format supported by many free software tools

Which are? This is the first I'm hearing of ttyrecord in the first place.

> Especially if I can pacman / apt-get install the tools.

asciinema is in the arch repos, "ttyrec" is in the AUR. Both are in the debian
repos.

> You want to show features, not look cool

The use you're talking about is in marketing material. Looking cool _is_ a
feature!

