2015-02-25 15:26:38 +01:00
|
|
|
# asciicast file format (version 1)
|
|
|
|
|
|
|
|
|
|
asciicast file is JSON file containing meta-data like duration or title of the
|
|
|
|
|
recording, and the actual content printed to terminal's stdout during
|
|
|
|
|
recording.
|
|
|
|
|
|
2017-03-15 17:11:44 +01:00
|
|
|
Version 1 of the format was used by the asciinema recorder versions 1.0 up to 1.3.
|
|
|
|
|
|
2015-02-25 15:26:38 +01:00
|
|
|
## Attributes
|
|
|
|
|
|
|
|
|
|
Every asciicast includes the following set of attributes:
|
|
|
|
|
|
|
|
|
|
* `version` - set to 1,
|
|
|
|
|
* `width` - terminal width (number of columns),
|
|
|
|
|
* `height` - terminal height (number of rows),
|
|
|
|
|
* `duration` - total duration of asciicast as floating point number,
|
|
|
|
|
* `command` - command that was recorded, as given via `-c` option to `rec`,
|
|
|
|
|
* `title` - title of the asciicast, as given via `-t` option to `rec`,
|
|
|
|
|
* `env` - map of environment variables useful for debugging playback problems,
|
|
|
|
|
* `stdout` - array of "frames", see below.
|
|
|
|
|
|
|
|
|
|
### Frame
|
|
|
|
|
|
|
|
|
|
Frame represents an event of printing new data to terminal's stdout. 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](http://www.ietf.org/rfc/rfc4627.txt), 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 printing and printing of `foo\rbar\u0007...`.
|
|
|
|
|
|
|
|
|
|
## Example asciicast
|
|
|
|
|
|
|
|
|
|
A very short asciicast may look like this:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"version": 1,
|
|
|
|
|
"width": 80,
|
|
|
|
|
"height": 24,
|
2015-03-02 11:16:36 +01:00
|
|
|
"duration": 1.515658,
|
2015-02-25 15:26:38 +01:00
|
|
|
"command": "/bin/zsh",
|
|
|
|
|
"title": "",
|
|
|
|
|
"env": {
|
2015-10-20 11:38:04 +02:00
|
|
|
"TERM": "xterm-256color",
|
2015-02-25 15:26:38 +01:00
|
|
|
"SHELL": "/bin/zsh"
|
|
|
|
|
},
|
|
|
|
|
"stdout": [
|
|
|
|
|
[
|
|
|
|
|
0.248848,
|
2015-10-20 11:38:04 +02:00
|
|
|
"\u001b[1;31mHello \u001b[32mWorld!\u001b[0m\n"
|
2015-02-25 15:26:38 +01:00
|
|
|
],
|
|
|
|
|
[
|
2015-10-20 11:38:04 +02:00
|
|
|
1.001376,
|
|
|
|
|
"I am \rThis is on the next line."
|
2015-02-25 15:26:38 +01:00
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
}
|