Coming to Asciinema Near You

## Metadata
- Author: [[The Changelog: Software Development, Open Source]]
- Full Title: Coming to Asciinema Near You
- Category: #podcasts
- URL: https://share.snipd.com/episode/1f99828a-cba5-46db-919b-ca38700f00eb
## Document Notes
## Highlights
- **Asciinema's Origin**
- Marcin Kulik built Asciinema because he was fascinated by the "magical" script command and wanted to share recordings.
- The initial prototype used jQuery to replay terminal sessions within a div element on a webpage.
Transcript:
Jerod Santo
Working on this. Can you take us back to the beginning? Why you built this in the first place and how?
Marcin Kulik
Yeah, it's even 12 years now. Why? That's a good question. I think it was just like a hacker spirit. I was playing in my terminal with this old school script command that some unique systems have like Linux and Mac OS. And it allows you it has its roots in like 70s, I think. And it just records all the terminal outputs into a file called TypeScript. TypeScript. I'm not confused with the TypeScript language. Yeah, yeah. This format predates the whole JS ecosystem thing. Before it was cool. Yes. It goes back to before TypeScript was cool. Exactly. I was playing with it and then it just felt so like magical when I replayed it in my terminal without touching the keyboard. And it was just like everything was, you know, like a ghost would be typing. And it felt really like really cool. And I thought, well, not many people know about this. And how can I share this my recordings with my colleagues? The immediate thing was like, well, I can send the TypeScript file over email, ask them to replay it in the terminal. And then it felt like, yeah, that's just too much to ask. And I thought, well, there should be a way to share this on the internet, on the website somewhere so I can just send a link to someone so they can watch it. And then I started experimenting on like, how would I replay such a file in a browser on the website? And yeah, it was just like me experimenting. But it was kind of like my initial prototype was jQuery based replay inside like a div element on a page like div element with some span elements inside with some styling, et cetera. And it was, yeah, like it was a proof of concept. It worked. So I thought, yeah, that sounds cool. And yeah, like fast forward 12 years and it's like a kind of bigger than I thought. And a lot of people use it. So there's been many phases in this project, the early stages and then there is some developments. It's been growing consistently gradually. So it was just like a fun site project initially. ([Time 0:05:27](https://share.snipd.com/snip/7119c1c9-2b46-4652-979c-c90f5ba09abb))
- **Text-Based, Not Video**
- Asciinema records terminal sessions as timed chunks of text data, not video, solving issues with blurry screen recordings.
- This approach captures the essence of the information with less bandwidth.
Transcript:
Jerod Santo
You were taking the script and actually animating what the script was doing. Exactly. So you aren't actually recording a video.
Marcin Kulik
That's, that's totally correct. So this was other than ability to share the recordings easily. The other aspect that I focused on since the beginning was to solve the blurry screen casts that were like the video at the time, like 2010, 2011 was okay, but not as, you know, high definition As these days. So when someone recorded a tutorial for YouTube or to put on their home website by just recording screen as in pixels to like a MP4 file or something like that, it didn't scale well. It was like way too much bandwidth for how little essence is actually in there, right? I mean by essence, like the core information payload. ([Time 0:10:48](https://share.snipd.com/snip/94f577e3-4d4f-4010-a3b4-9880b7a02261))
- **Emulator at Heart**
- The Asciinema player embeds a terminal emulator written in Rust and compiled to WebAssembly.
- It reconstructs the terminal environment from the recorded byte stream, ensuring accurate playback.
Transcript:
Marcin Kulik
It's animating the terminal. So maybe I go back a little before animation. What happens is actually the player embeds a terminal emulator. So like you have your i-term or terminal app or electricity or X-term in order to correctly display how terminal looked at the time of recording, it needs to be recreated as a time of playback. So their quarter doesn't record your terminal visually. It doesn't grab the text characters like a grid. It just intercepts the standard output and everything that the applications like your shell or other applications that are running in your shell are writing to the terminal. So it's just like a byte stream. And so the player reconstructs that basically it's a simple terminal emulator in the shape of something that looks like a video player. Right. So at the heart of it, there's an actual terminal emulator. These days, it wasn't like that from the beginning, but these days, this is the terminal emulator. I wrote this written in Rust and it's compiled to WebAssembly. And it's embedded in the JS player. ([Time 0:12:00](https://share.snipd.com/snip/9728d22c-a207-4547-8129-8eceedb12b66))
- **Efficient Recording Format**
- Asciinema uses a JSON-based text format called asciicast, resulting in small file sizes.
- Recordings only capture changes in the terminal output, minimizing storage space.
Transcript:
Marcin Kulik
So, for the format, their quarter uses is called ASCII cast, which is JSON based text format, which you can just open and read. Current version of the recorder uses ASCII card format version two, which is like JSON LD or well, the JSON new line delimited format where you have like a JSON document on every line. Those are small JSON documents. Calling them documents is not there I think here. But it's a kind of readable format. It's documented in the ASCII NEMA repository. So you can write your own recorder. You can write your own player. And then you can deal with those ASCII cast recordings. So how the recorder works is when you start a ASCII NEMA at a recorder in your shell, it creates a thing called pseudo terminal, like a Unix systems have this capability, PTY pseudo terminal, Which creates like a imitation of a terminal for the program which runs in it. So ASCII NEMA recorder creates pseudo terminal inside of which it launches your shell again, and that shell gets recorded. And whatever you type in it gets recorded. So by being in control of this pseudo terminal, their recorder can intercept all the output that goes from your programs inside the terminal, as well as all the inputs, which is the key Strokes, but that's off by default. So you can actually capture key strokes and they, these would be also included in the ASCII cast file.
Adam Stacoviak
Does it also record things like VIM, like if you open up VIM and different things like this, it's a record, literally everything and it recreates, you know, as if you're sitting there Watching my terminal in the past, obviously, it's a video.
Marcin Kulik
Yes, yes. It records everything like VIM. What have you there? Like anything. Oh, right now, the only thing that you cannot really reproduce is like those new, newfangled things like images in displaying like regular images inside terminal. Emoji? How about emoji? Well, emoji works. So the recorder and player speak UTF-8 natively. And so emoji also works there. Yeah. And the whole recording when you let's say you record a short session, like five minute long depends on what you do there and how much activity is there. Rather, it can like take like 10 kilobytes of disc size. And if you would like start recording session and like want to make a coffee for like, and forgot about it, like for 10 hours, let's say, and you come back to your computer at night and then It's still there. For this 10 hours, it would write zero bytes to the disc because it only captures.
Jerod Santo
Not ([Time 0:15:11](https://share.snipd.com/snip/f3e94b7f-b641-41a5-a20c-b7ab41ebc0fb))
- **Playback Tips**
- Use speed control and idle time limiting in Asciinema player for better viewing.
- Adjust playback speed (e.g., speed=2 for double speed) or set max inactivity time to remove pauses.
Transcript:
Marcin Kulik
Yeah. There are two controls that you can that you can use for to make it more pleasant to watch. So one, one thing, the speed of playback is the player supports changing the speed. So one way you can do is when you self host the player, which is available as an NPM library that you can embed on your own website, there's this option when you initialize the player option Called speed. And then you can just pass a number two, for example, and you have like a double speed or dot five to half the speed for the recordings on the Askinima or website. When you have one open, you can append to the URL parameter, like question mark speed equals two. And then you will have it like doubled. So that's one thing, like good old speed control on that note. One thing that's missing from the player's UI is the ability to change the player on the fly. Just by clicking the UI, which is all my to the list, which is always growing. But that's probably something that would be neat there. ([Time 0:23:53](https://share.snipd.com/snip/60e020e9-8518-459b-afb0-bd36d8cbf129))
- **Open Source and Community**
- Asciinema remains a free and open-source project supported by the community.
- Marcin prioritizes learning, experimentation, and community over monetization through a SaaS model.
Transcript:
Adam Stacoviak
My question is with that capability. What is the limit? What is the possibility? Like I know this is an open source project. I don't know how you maintain it in terms of like your financial stability with it. You know, the support on it. You have a sponsor or two and they have backers. I think through get up sponsors, probably things like that. How do you vision the possibility where this can go? Like this seems very capable of being more than what it is. Not that it's not enough, but it's got a lot of possibility potential. Yeah.
Marcin Kulik
So as I mentioned, I have like a huge backlog of things to work on and both missing features requested by by users as well as some crazy ideas. I dream up once in a while. Maybe maybe I'll touch a bit on how the development progresses and how I do it in terms of like time and the resources. Sure. First. So pretty much since the beginning, it was a hobby project and it's still kind of is it now is it's more more than that, but but it's been a side project that I've been working on in my spare Time exclusively while having a regular developer job. And there were phases where I had a little bit more time to spend on this project and there were like literally years that I had very little time for maintenance, not even for thinking Of new features. So it's not a business. It's not a product. It's it's always been an open source project. I've been over the idea that maybe turning it into business would be something cool. Like many times I've been over this, but I haven't decided to turn it into like a let's say, SaaS product, like software service where I just like offer like premium accounts and try to Monetize users. Maybe I well, first I just it's just too much fun to ruin it with with like money chase for me. It's a great place where I can learn new technology play with some cool stuff and there's like no stakeholders. Nobody ([Time 0:30:40](https://share.snipd.com/snip/3c5c591d-d6c0-4687-b548-0183f70b55d9))
- **Audio Support**
- Consider adding audio support to Asciinema for tutorials and demos.
- Many users resort to YouTube for audio narration, a feature Asciinema could incorporate.
Transcript:
Jerod Santo
Like it's a big thing, but also kind of changes the project, perhaps, is I'm sitting here watching a Star Wars episode four, which is a really cool one, by the way, it's like 17 minutes. And I hate that it's episode four. It's like, come on, guys, it's the first one. But OK, let's knock it off on Star Wars. A new hope as they renamed it to. And I'm thinking like I would love to have, you know, the the audio. And of course, when you're doing tutorials and stuff, the one thing that's missing is audio, right? I mean, but at the same time, I understand the purity of text only and the fact that you can safely hit that play button and not worry about it blasting. Or maybe it does blast and I just have muted. Is there audio in this thing? I haven't found out. There isn't OK. Now there's a I don't want to start a second guess myself. I'm like, oh, maybe it's there and I just don't see because everything I'm seeing is just, you know, it's text and it's it's awesome. But ([Time 0:35:40](https://share.snipd.com/snip/0e3d8698-6e43-4d61-9663-e98fbf4c9cf2))
- **Captions as Alternative**
- Implement captions or subtitles in Asciinema as a text-based alternative to audio.
- This aligns with Asciinema's text-based nature and offers accessibility benefits.
Transcript:
Jerod Santo
I bring up audio and answer Adam's question directly is because when I look at what people use for their demos, it's either asking Emma or it's a YouTube video embedded and YouTube videos Have audio. So maybe if you want to put a cool soundtrack to your 45 second deal, or if you want to narrate and walk through what it is that you're showing off, it's just very handy to have an audio track. And so I think that that's compelling. And I think there's a lot of people who use YouTube because they can do both. And I think that if Esquino did both, at least even if it was just default off, but you could get it done, I think that might be compelling for a lot of people. That's ([Time 0:42:17](https://share.snipd.com/snip/6c2c475c-04bd-48c1-8d37-897828f432a2))
- **GIFs for Sharing**
- Jerod Santo often converts Asciinema recordings to GIFs for sharing projects.
- He finds GIFs easier to share than embedding Asciinema recordings, highlighting a usability gap.
Transcript:
Jerod Santo
Is exciting for me. Because as a person who routinely helps other people with getting eyeballs on their projects, I'm often looking for the GIF or the image to help share what they're up to. And oftentimes I'll come across, cross or read me, they'll have an askinama and I'll think, Oh, this is actually harder for me to share than if this was just a GIF embedded in here. And I did not know about this until today. Is this a brew install away?
Marcin Kulik
How do I get to think install cargo install? Well, you can, I think it may be in brew Docker, Docker pod. You can try brew. I'm gonna go to a shot, brew install. Ag, see what happens. Yeah. Well, I have, I had this funny relationship with gift generation. Actually, since, uh, GIF is very inefficient format for it is kind of video. It's like the worst, but at the same time, it's so easy to embed everywhere. So people just use it. It's like, yeah, so initially I thought it's like such a bad idea. It's like, it stands like, you know, position to what the project was meant to be like lean, uh, tiny files with sharp rendering and people started asking for that. We're going to commit them to get how can I convert it to MP4 and stuff like that. So like after like many, many people asked about it and tried very various approaches, I thought, okay, I, I can spend some time on that. So even though I always prefer, you know, the, the real thing, yeah, the, the seeing in a player where you can, you know, rewind, pause, et cetera. I see like, like how, how it's useful. And ([Time 0:49:00](https://share.snipd.com/snip/09d4d451-0a92-4e31-81db-eb9ffeef9700))
- **Future of Asciinema**
- Marcin's primary goal is to work on Asciinema full-time through community support.
- He envisions expanding Asciinema's capabilities, including live streaming for terminal enthusiasts.
Transcript:
Jerod Santo
Way, I'm sure you'll still be motivated, right? Because you love open source. I don't know.
Adam Stacoviak
Off topic, off topic. It is off topic. We're biting it a little bit. I guess I want to come back to maybe less to say what you should do, but more like, what do you want to do with this? Like, given the possibility and the potential here, like if you could just wave a magic wand, what would it be? Like, would it be you don't work anywhere else and do different things and you find a way to convert this into a lifestyle business? Maybe you have one or two employees. Like, what do you want from this?
Marcin Kulik
I would like to be able to just work on it and not really imagining myself turning it into business, but just like really keeping this as a free software and something that people really Enjoy to use and admire. Because I'm constantly hearing how people are amazed by this, like specifically like how it works and, you know, and this keeps me going. I really, I really enjoy it. And I've been programming my whole life and I've been doing it for just for fun. And I want to keep it that way. So if I could wave a magic wand, I would love to have enough sponsors, patrons, that would allow me to focus on this for as long as possible. ([Time 1:08:36](https://share.snipd.com/snip/5ba61af0-fd35-419a-a45e-b285fc0f759f))