mirror of
https://github.com/asciinema/asciinema.git
synced 2026-04-25 07:55:51 +03:00
[GH-ISSUE #636] Proposals to --append recording mode improvements #330
Labels
No labels
bug
compatibility
feature request
fit for beginners
help wanted
hosting
idea
improvement
packaging
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asciinema#330
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @anton-sergeev on GitHub (Jun 2, 2024).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/636
Hi all!
Used asciinema cli version: v2.4.0.
I recently discovered the
--appendrecording flag and noticed following points/peculiarities in the places of gluing:To solve this issue, I manually press
Enterto inject "newline" into the recording file at the beginning of recording in--appendmode.To solve this issue, I manually resize the terminal at the beginning of recording in
--appendmode, which injects a"r"command into the recording file.My proposal here is to automatically inject "newline" and
"r"command into the recording file when running--appendmode.Another thing, is the timestamps in the recording file. No matter how much actual time has passed between two parts, the first commands of the second part timed as they were right after the end of the first part. Here is example (not real):
Finally, a quick search didn't get an answer on conceptual limitation of
--appendmode: should it support changing theme, title or other things from here? Or better to use separate recording in this cases?@ku1ik commented on GitHub (Jul 3, 2024):
Hey 👋
While injecting a newline may seem like a solution it's not going to solve the problem for many situations where recording is stopped abruptly.
For example, when recording stops while there's a "full screen" program such as vim running, the terminal is left in a state which is far from the default, normal state a shell would expect - the active screen buffer could be set to alternate instead of primary (which doesn't have scrollback), the cursor may be hidden, the control sequence parser may be in some intermediate state expecting more parameters, etc etc. Just adding a newline won't revert those changes to the internal terminal state, and this will likely result in the initial output of the appended recording to produce garbage or other types of inaccurate positioning of printed text. In other words, adding a newline can help in some cases (e.g. when there were no full screen programs recorded), but will not solve it comprehensively.
Given the above I think it's not worth it to implement such workaround. If in your setup the probability of abrupt ending of a recording session is high then my suggestion is to not use
--appendand always recording to individual files.I think this is something we could add, it seems like a nice, low effort improvement. It would be ideal to insert the resize event only if window size is different than in the original recording. Also, actually, given the original recording might have resize events, to know if the window size changed we would need to use the last known window size instead of just the initial one in order to reliably check if the insertion of the new resize event is necessary. Either way, this sounds good 👍
This is by design. The idea for this behavior is that you can stop recording, prepare for another round, and resume recording, and the replayed session should look as if there wasn't any pause. In your example the difference between last event of the original recording (
73.126504) and the first event of the appended recording (73.147615), which is ~0.02s is a time between the start of the 2nd recording session and the first output event. The appended events are just shifted by the last event time from the original recording (73.126504), i.e.73.126504is added to every new event time.I guess we could introduce a new option which would allow specifying additional delay between the sessions, that would shift the new events farther 🤔
@anton-sergeev commented on GitHub (Jul 3, 2024):
In my use cases, it is very useful to be able to restore the absolute time for saved entries/records in record file.
So, actually my point here not a "little gap" but loss of the ability to reconstruct absolute timestamps.
For fixing big intervals between glued parts there is a
idle-time-limitplayback option (which I always use).@ku1ik commented on GitHub (Sep 11, 2025):
Quick update about recent improvements in the discussed areas:
The new asciicast v3 file format uses relative/delta time. This makes time adjustments way easier - for example, if you need to increase the delay between first and second concatenated recording you can change the time interval of the first event in the second recording before concatenating them. This is manual, so not ideal, but still an option (can be scripted though). I guess we could have a flag to enable concatenation mode where the subsequent recording base time uses offset from the header timestamp. I guess that's what you expected in the first place, right?
Regarding the terminal resizing - I modified how concat and
--appendwork - they now inject"r"event automatically at join points between recordings.@anton-sergeev commented on GitHub (Sep 12, 2025):
Super!
Yes, an extra flag for this behavior is ideal.
Off-topic:
One of my use cases is for shell logging history (mentioned in the previous message). Sometimes I need to know when some commands were run, so I manually look for timestamps in the asciicast file. With the v3 delta times, this adds an extra step - calculating all time values from the beginning of the file.
And players, I suppose, should do the same when playback jumps to a random position.
Also, floating point calculations add errors, so the error will increase with the number of lines-records in the asciicast v3 file. This is not a big problem, just a pedantic note :)
Is there a public discussion somewhere about the new version of the file format?