[GH-ISSUE #117] [Feature request] Allow some sort of "commenting" inside the asciinema JSON #703

Closed
opened 2026-03-15 08:56:36 +03:00 by kerem · 12 comments
Owner

Originally created by @pdfkungfoo on GitHub (Jun 30, 2015).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/117

ASCiinema's popularity will improve the more, the better the contents of screencasts are. However, to produce _really good_ ASCiinema playback material, there is a need to _edit_ the original recordings.

While editing recordings isn't a problem per se, to do so with a file that plays longer than 1 minute is quite a stretch, because it is difficult to navigate its structure. If we could insert comments (which should be ignored when playing the file), that task would get more easy.

I am aware that "pure" JSON does not allow comments.

However, for asciinema it would be a nice feature if I could insert lines like

# this is a comment; we are @ playtime 1:03 right now; this is line 2345 of recording

This would help immensely when editing a recorded file.

Originally created by @pdfkungfoo on GitHub (Jun 30, 2015). Original GitHub issue: https://github.com/asciinema/asciinema/issues/117 ASCiinema's popularity will improve the more, the better the contents of screencasts are. However, to produce **_really good**_ ASCiinema playback material, there is a need to **_edit**_ the original recordings. While editing recordings isn't a problem per se, to do so with a file that plays longer than 1 minute is quite a stretch, because it is difficult to navigate its structure. If we could insert comments (which should be ignored when playing the file), that task would get more easy. I am aware that "pure" JSON does not allow comments. However, for `asciinema` it would be a nice feature if I could insert lines like ``` # this is a comment; we are @ playtime 1:03 right now; this is line 2345 of recording ``` This would help immensely when editing a recorded file.
kerem 2026-03-15 08:56:36 +03:00
Author
Owner

@ku1ik commented on GitHub (Jun 30, 2015):

I see your point. However we cannot make the JSON file "special" because it is also meant to be read by web browsers and other external tools. By using unsupported syntax in JSON we would break all of them (except the asciinema recorder/player).

<!-- gh-comment-id:117313016 --> @ku1ik commented on GitHub (Jun 30, 2015): I see your point. However we cannot make the JSON file "special" because it is also meant to be read by web browsers and other external tools. By using unsupported syntax in JSON we would break all of them (except the `asciinema` recorder/player).
Author
Owner

@pdfkungfoo commented on GitHub (Jun 30, 2015):

I was not aware that web browsers read (and process) the JSON directly.

Which ones would that be? On what occasions?

Also, which "other external tools" are you aware of that can replay asciinema JSON files?

<!-- gh-comment-id:117355034 --> @pdfkungfoo commented on GitHub (Jun 30, 2015): I was not aware that web browsers read (and process) the JSON directly. Which ones would that be? On what occasions? Also, which _"other external tools"_ are you aware of that can replay `asciinema` JSON files?
Author
Owner

@ku1ik commented on GitHub (Jul 1, 2015):

The asciinema player will soon be able to play asciicast directly from JSON file produced by the recorder, allowing for easy self hosting (asciinema.js + your-recording.json). It's not yet there but will be soon. One of the reasons for choosing JSON for asciicast file format is it's good, native support by web browsers.

I'm not aware of any other players, but I can see some editing/optimizing tools coming and I want to make it easier for people by allowing to use standard, often built-in JSON parsers.

Also, see this: https://gist.github.com/sickill/1c44512cac222c8afea7

<!-- gh-comment-id:117764134 --> @ku1ik commented on GitHub (Jul 1, 2015): The asciinema player will soon be able to play asciicast directly from JSON file produced by the recorder, allowing for easy self hosting (asciinema.js + your-recording.json). It's not yet there but will be soon. One of the reasons for choosing JSON for [asciicast file format](http://blog.asciinema.org/post/one-point-o/) is it's good, native support by web browsers. I'm not aware of any other players, but I can see some editing/optimizing tools coming and I want to make it easier for people by allowing to use standard, often built-in JSON parsers. Also, see this: https://gist.github.com/sickill/1c44512cac222c8afea7
Author
Owner

@noisy commented on GitHub (Jul 21, 2015):

@KurtPfeifle @sickill maybe the solution would be to write a (maybe 3rd party) visual editor for screencasts. I think it should be possible to add ascii-callouts in specified places on the screen, which will be displayed on screencast for specified time.

<!-- gh-comment-id:123263521 --> @noisy commented on GitHub (Jul 21, 2015): @KurtPfeifle @sickill maybe the solution would be to write a (maybe 3rd party) visual editor for screencasts. I think it should be possible to add ascii-callouts in specified places on the screen, which will be displayed on screencast for specified time.
Author
Owner

@ku1ik commented on GitHub (Jul 21, 2015):

@noisy I think @KurtPfeifle is talking about different thing. If I'm getting this correctly what you described is "subtitle" support, with the data coming directly from the asciicast file (as an additional "overlay text track"). @KurtPfeifle wanted to put comments into the asciicast JSON file so he can navigate throughout the file easier, but these comments should be ignored during playback.

<!-- gh-comment-id:123347270 --> @ku1ik commented on GitHub (Jul 21, 2015): @noisy I think @KurtPfeifle is talking about different thing. If I'm getting this correctly what you described is "subtitle" support, with the data coming directly from the asciicast file (as an additional "overlay text track"). @KurtPfeifle wanted to put comments into the asciicast JSON file so he can navigate throughout the file easier, but these comments should be ignored during playback.
Author
Owner

@ku1ik commented on GitHub (Mar 26, 2016):

One option I see here to make editing easier is to use absolute time instead of relative one - would make finding the right spot much easier. We can discuss this in a separate issue though. As for adding comments to JSON, it's not going to happen.

<!-- gh-comment-id:201826291 --> @ku1ik commented on GitHub (Mar 26, 2016): One option I see here to make editing easier is to use absolute time instead of relative one - would make finding the right spot much easier. We can discuss this in a separate issue though. As for adding comments to JSON, it's not going to happen.
Author
Owner

@pdfkungfoo commented on GitHub (Mar 26, 2016):

I would not like absolute time, because some of my editing modifications also spans changing the timings.

To get this "right" would be much more difficult with absolute times. (Currently, I can speed up or slow down individual lines by just overwriting one digit at the right spot...)

<!-- gh-comment-id:201868517 --> @pdfkungfoo commented on GitHub (Mar 26, 2016): I would not like absolute time, because some of my editing modifications also spans changing the timings. To get this "right" would be much more difficult with absolute times. (Currently, I can speed up or slow down individual lines by just overwriting one digit at the right spot...)
Author
Owner

@pdfkungfoo commented on GitHub (Mar 26, 2016):

So, it is too difficult to make the asciinema playback tolerant of sprinkled in comment lines? (These could also be automatically removed upon publication.)

<!-- gh-comment-id:201869024 --> @pdfkungfoo commented on GitHub (Mar 26, 2016): So, it is too difficult to make the asciinema playback tolerant of sprinkled in comment lines? (These could also be automatically removed upon publication.)
Author
Owner

@ku1ik commented on GitHub (Mar 26, 2016):

JSON doesn't support comments and we use default JSON parsers for loading the recording - Go's stdlib JSON parser (when you asciinema play file.json in terminal), and web browsers' own JSON parsers when playing in the web player.

Alternative could be to support additional file format, for example edn, which is human readable and supports commenting.

<!-- gh-comment-id:201872526 --> @ku1ik commented on GitHub (Mar 26, 2016): JSON doesn't support comments and we use default JSON parsers for loading the recording - Go's stdlib JSON parser (when you `asciinema play file.json` in terminal), and web browsers' own JSON parsers when playing in the web player. Alternative could be to support additional file format, for example [edn](https://github.com/edn-format/edn), which is human readable and supports commenting.
Author
Owner

@pdfkungfoo commented on GitHub (Mar 26, 2016):

It would be "good enough" to make asciinema play file.json tolerant for commented lines.

Couldn't it be implemented by a two-stage approach:

  1. filtering out comments from the non-standard JSON (using a simple grep -v-alike routine) before
  2. handing over the filtered standard JSON to the currently used JSON parser

?

Sorry if this sound dumb -- I'm not a programmer.

<!-- gh-comment-id:201891136 --> @pdfkungfoo commented on GitHub (Mar 26, 2016): It would be "good enough" to make `asciinema play file.json` tolerant for commented lines. Couldn't it be implemented by a two-stage approach: 1. filtering out comments from the non-standard JSON (using a simple `grep -v`-alike routine) before 2. handing over the filtered standard JSON to the currently used JSON parser ? Sorry if this sound dumb -- I'm not a programmer.
Author
Owner

@ku1ik commented on GitHub (Mar 26, 2016):

You can do it now like this:

grep -v "..." file.json | asciinema play -
grep -v "..." file.json | asciinema upload -
<!-- gh-comment-id:201901600 --> @ku1ik commented on GitHub (Mar 26, 2016): You can do it now like this: ``` grep -v "..." file.json | asciinema play - grep -v "..." file.json | asciinema upload - ```
Author
Owner

@pdfkungfoo commented on GitHub (Mar 26, 2016):

Ouuuhhhh....

Thanks a lot. That's probably good enough for me. ;-)

I'll give it a workout soon.

(I had not been aware that asciinema could work with input...)

<!-- gh-comment-id:201904860 --> @pdfkungfoo commented on GitHub (Mar 26, 2016): Ouuuhhhh.... Thanks a lot. That's probably good enough for me. ;-) I'll give it a workout soon. (I had not been aware that `asciinema` could work with <stdin> input...)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#703
No description provided.