Is it possible to "script" asciinema?

So something I’ve always wanted is the ability to “script” a video, so that all i have to do is edit the script file then regenerate the video.

I think I could hack this together by using shell-mode in emacs and then writing elisp to send commands to it. But, has anyone else done something like this?

An example, I have a project , and i get a lot of people who don’t quite “get” why the project would be useful. So I thought having a screencast would be a great way to “demo”. Basically, if I could script it, what I would do is something like:

cd to some directory
run a bunch of git and touch commands to set up a repo in a certain way.
start asciinema
run my project (and script the way it should interact)
stop asciinema.

I hope that is clear. The big value would be in having a repeatable “setup” and it would be a lot easier to add and remove demo features.


Well yes, pretty easy. Maybe even easier than you think!

The --command= option allows to specify the program you run, it’s $SHELL by default. Just set it to whatever program you can script in which will literally output the “movie” to its stdout! Then you get the scriptability from the program (oh I guess it’ll be rich in sleep() calls), as well as the preserved recording from asciinema. That’s Unix-style program composition!

Too bad you can’t really edit the recordings… Or can you? However there’s also asciinema rec --stdin mode, which’ll record your manual timed input into the replayable file.

I hope, some combination of these would become useful!

1 Like

Thank you! and sorry for the belated reply. I think I’m going to start working on this soon. WOuld you be interested in hearing what I come up with?

1 Like