Asciinema – Record and share your terminal sessions
asciinema.org
asciinema.org
Block - https://asciinema.org/a/125371
Waterfall - https://asciinema.org/a/125380
[0]: https://www.ioccc.org/2012/endoh1/hint.html
[1]: https://www.ioccc.org/2012
[2]: https://www.ioccc.org/2012/endoh1/endoh1.c
My use case for terminal demos is very different from that. Usually I'm just recording something short and emailing it to one person. Bandwidth savings do not accumulate across many website visitors, and simple is perfect.
The nice thing about video is I can just email it. I don't need to host a web server instance for playback. Even at very high quality settings ("ffmpeg -qscale:v 1", nothing blurry about it) the resulting video is only about 1MB/minute (80x24 term, h264 or h265).
Here's my demo workflow, in case folks are curious:
1. simplescreenrecorder to record terminal window + voice.
2. ffmpeg -i recorded.mkv -vcodec libx264 -qscale:v 1 -acodec aac encoded.mp4 # or s/264/265/ for slightly better compression, if the receiver has new enough codecs
3. Email the video or whatever.
That's it.
For example, at 00:11 of https://asciinema.org/a/139514
Puzzle: 54-14343245-14134544-48EW.53NE
1 4 1 3 4 5 4 4 1 4 1 3 4 5 4 4
┌─┬─┬─┬─┬─┬─┬─┬─┐ ┌─┬─┬─┬─┬─┬─┬─┬─┐
8 │ │ │ │━│ │ │ │ │ 5 8 │ │┏│━│━│┓│ │ │ │ 5
├─┼─┼─┼─┼─┼─┼─┼─┤ ├─┼─┼─┼─┼─┼─┼─┼─┤
7 │ │ │ │ │ │ │ │ │ 4 7 │ │┃│ │ │┗│━│┓│ │ 4
├─┼─┼─┼─┼─┼─┼─┼─┤ ├─┼─┼─┼─┼─┼─┼─┼─┤
6 │ │ │ │ │ │ │ │ │ 2 6 │ │┃│ │ │ │ │┃│ │ 2
├─┼─┼─┼─┼─┼─┼─┼─┤ ├─┼─┼─┼─┼─┼─┼─┼─┤
A │━│ │ │ │ │ │ │ │ 3 A │━│┛│ │ │ │ │┃│ │ 3
├─┼─┼─┼─┼─┼─┼─┼─┤ ├─┼─┼─┼─┼─┼─┼─┼─┤
4 │ │ │ │ │ │ │ │ │ 4 4 │ │ │ │ │┏│━│┛│ │ 4
├─┼─┼─┼─┼─┼─┼─┼─┤ ├─┼─┼─┼─┼─┼─┼─┼─┤
3 │ │ │ │ │┗│ │ │ │ 3 3 │ │ │ │ │┗│ │ │ │ 3
├─┼─┼─┼─┼─┼─┼─┼─┤ ├─┼─┼─┼─┼─┼─┼─┼─┤
2 │ │ │ │ │ │ │ │ │ 4 2 │ │ │ │ │ │ │ │ │ 4
├─┼─┼─┼─┼─┼─┼─┼─┤ ├─┼─┼─┼─┼─┼─┼─┼─┤
1 │ │ │ │┃│ │ │ │ │ 1 1 │ │ │ │┃│ │ │ │ │ 1
└─┴─┴─┴─┴─┴─┴─┴─┘ └─┴─┴─┴─┴─┴─┴─┴─┘
1 2 3 B 5 6 7 8 1 2 3 B 5 6 7 8[1]: https://hn.algolia.com/?query=asciinema&sort=byPopularity&pr...
I use it only very occasionally, like once a year, but love the way it works. My first experience was perfect, I really couldn't think of a single thing to improve (and that's very rare), so that left a very good impression.
Super useful for sharing because then the other parties don't need this software installed.
TLDR: Wish it included some functionality to get finished usable media artifacts out.
In the end I gave up after failing to find a way to convert the resulting asciinema data files to a GIF or any other HTML-compatible media file. The open-source projects ended up not working for various reasons- broken shell scripts, abandoned projects, node.js programs that require a fully working phantomjs installation and then it still doesn't work, requiring docker (come on, really? Spin up containers just to convert to a GIF?), and these are only the problems I remember offhand.
Some breadcrumbs:
https://www.google.com/search?q=asciinema+convert+to+gif
https://unix.stackexchange.com/questions/314235/converting-a...
"asciinema doesn't provide this natively, there are tools out there that can facilitate that for you"
Right.
https://raw.github.com/laurent22/massren/animation/animation...
As far as I remember it was easy to use and the result was pretty good. Back then I've also tested Asciinema but gave up for the same reasons.
[0] http://0xcc.net/ttyrec/ [1] https://github.com/icholy/ttygif
i'm way more confused than disappointed and wonder how easy it would be to rip this for use in a non-public environment?
{"timestamp": 1526123655, "version": 2, "height": 55, "env": {"SHELL": "/bin/bash", "TERM": "screen"}, "width": 179}
[0.046457, "o", "namibj@nb:~/git/namibj/ind3xlite$ "]
[3.021128, "o", "l"]
[3.116894, "o", "s"]
[3.468747, "o", "\r\n"]
[3.472283, "o", "\u001b[0m\u001b[01;32mind3xlite\u001b[0m LICENSE main.c main.h Makefile README.md sqlite3.c sqlite3.h sqlite3.o\r\n"]
[3.472869, "o", "namibj@nb:~/git/namibj/ind3xlite$ "]
[4.092707, "o", "e"]
[4.340945, "o", "x"]
[4.548934, "o", "i"]
[4.653126, "o", "t"]
[4.859118, "o", "\r\n"]
[4.859605, "o", "exit\r\n"]
As you can see, it was easy for me to redact the user and hostname from the prompt, without you even seeing it.
The canonical implementation is in python (3 iirc), but you should be able to hook a non-x11 terminal emulator up and make that spew out frames for each individual timestamp, and just create a variable framerate mkv from that. With uncompressed video. This is then trivial to feed into ffmpeg for transcoding into your favourite codec, possibly even including a different stream for audio into the resulting mux.
I might, if I'd get a reason to do this before other projects, take an existing terminal emulator and teach that to do this (or possibly directly to lossless VC1, removing the need to search for matching glyphs later in the process, which should yield reasonably small files directly from the conversion, without quality loss). So, if someone want's me to do this, email's in my profile.This can be done via jq [0]. See the simple script [1] I made. It relies on things like tab-expansion yielding the same results, so beware.
[0]: https://github.com/stedolan/jq [1]: https://0x0.st/sj0G.txt (License: AGPLv3, credit to my handle)
asciinema rec --stdin
and it will execute whatever was in there. If some programs were reading more than they actually wanted, it would have trouble, because they would likely get fed further commands/input, which would no longer go to the shell/later program.Regarding the script, it's just using jq because asciinema uses a JSON-based format, of which some data needs to be extracted. It should be self-evident from looking at what jq is doing and what an interactive shell does different from a non-interactive one (hint: it's related to autocompletion), as well as a sample file created by the above command. If you still don't understand, tell, and I'll try to explain better.
And sorry for the delay, I wasn't expecting a timely response that asks me for something.
less -U and look if that seems to be what you were typing. If you want, you can replay the special chars by pressing Ctrl+<whatever symbol is followed by the caret>. Try to not use a fancy auto-completion like fish or fzf provides you with, as they tend to not be the same when doing a replay.
This should not be hard, I used bash succesfully. I hope you did not forget to run it on the same filesystem state, as far as auto-complete behavior during the asciicast is concerned.
Also, this could be improved by delaying the replay as long as specified by the asciicast. But I couldn't quickly figure out how to get that done without further dependencies, so I won't provide that (now).
This script filters for input keys from the asciicast with the
select("i" == .[1]?)
and then extracts only the string itself with .[2]
. I'd like to understand what is going wrong, but this style of debugging isn't working.
I won't debug it on your system unless you find a way to make that sufficiently productive for me.
And I really hope you created the file with --stdin, but judging from ls barfing on a non-existent file/directory, I assume the shell it spawned just did not result in ls being called with the same name, due to auto-complete changing it's behavior.But it seems to me we were using the term "live" differently. I think I understand now that the code you provide runs the recording on the current machine - similar to a macro. The live mode I was referring from pias takes the recording - but times the keystrokes to what you type during the presentation - so one doesn't need to check. Makes also a nice trick for showing off as one can do fun stuff like type with your feet. Ah I see - they call this "manual typing", and have a "Live Replay" - just as you suggested. So it was me being inprecise - sorry.
You were right the errors I was experiencing had to do with the shell. I use fish - forcing everything to use bash made previous errors disappear. However in my test recording the it got stuck in vim - suppose escape didn't work.
If you want it to push from the top, I could understand... but in the middle?
IMO, the killer feature is how easy it is to embed recordings into your project readme or issues/comments in markdown/html.
This is a perfect example of why engineering has a separate marketing division.
http://man7.org/linux/man-pages/man1/script.1.html
Still, that's pretty sick that you can pause the "video" and highlight/copy/paste in-browser
script -tshell_recording.time shell_recording.script bash
scriptreplay -t shell_recording.time shell_recording.script