asciicast v1¶
asciicast v1 is a file format for terminal sessions recorded by asciinema CLI 1.x.
It's based on JSON.
The format describes terminal metadata, such as initial terminal size, timestamp, etc, and a list of timed output (terminal write) events that were captured during recording session.
asciicast v1 file looks like this:
{
"version": 1,
"width": 80,
"height": 24,
"duration": 1.515658,
"command": "/bin/zsh",
"title": "",
"env": {
"TERM": "xterm-256color",
"SHELL": "/bin/zsh"
},
"stdout": [
[
0.248848,
"\u001b[1;31mHello \u001b[32mWorld!\u001b[0m\n"
],
[
1.001376,
"I am \rThis is on the next line."
]
]
}
Attributes¶
Every asciicast v1 includes the following set of attributes:
version
- must be set to 1,width
- terminal width, i.e. number of columns,height
- terminal height, i.e. number of rows,duration
- total duration of the recording, as a floating point number,command
- recorded command, as given via-c
option torec
, optional,title
- title of the recording, as given via-t
option torec
, optional,env
- map of environment variables, usually includesTERM
andSHELL
,stdout
- array of "frames", see below.
Frames¶
Frame represents an event of printing new data to a terminal. It is a 2 element array containing delay and data.
Delay is the number of seconds that elapsed since the previous frame (or since the beginning of the recording in case of the 1st frame) represented as a floating point number, with microsecond precision.
Data is a string containing the data that was printed to a terminal in a
given frame. It has to be valid, UTF-8 encoded JSON string as described in JSON
RFC section 2.5, with all non-printable
Unicode codepoints encoded as \uXXXX
.
For example, frame [5.4321, "foo\rbar\u0007..."]
means there was 5 seconds of
inactivity between previous output and foo\rbar\u0007...
.