feat:get timestamp for each command with flag --with-timestamp or -t
Adds feature #584
Hey @Exar04 thank you for the PR, it's indeed a nice feature to add. Two things though, could you add tests about this functionality? and second would be nice --timestamp if it actually receive an unix POSIX for retrieve timestamp like '%d/%m/%Y_%H:%M:%S:%N' would return 20/04/2025_11:47:43:32. It would allow people configure their timestamp in the way they would want to.
One issue with this is that there isn't a separate timecode for each typed letter. One use case for the timecode is being able to add audio and this wouldn't be enough to add audio to each keystroke.
I see @Soviut seems hard to implement but I will give it a try.
@raphamorim yeah I will add tests at the end, after the complete feature is implemented.
Perfect, please lemme know if need help with anything. Feel free to ping on my discord
I see @Soviut seems hard to implement but I will give it a try.
@raphamorim yeah I will add tests at the end, after the complete feature is implemented.
You could infer the current typing speed which is how frequently the Type command types a character. Then multiply that by the number of characters.
https://github.com/charmbracelet/vhs?tab=readme-ov-file#set-typing-speed
The TypingSpeed changes the speed globally. While, you can also change the speed of a single Type command.
To handle timecodes with milliseconds it's usually HH:MM:SS,mmm. There's also HH:MM:SS:FF that will capture the current frame, assuming we know the framerate.
Also what should be the names for the the tags @Soviut @raphamorim
20/04/2025_11:47:43:32
I mean its just a stopwatch. should it have dates and stuff?
Hey @Exar04 timestamp term isn't just about dates when comes to unix, but sure just allow formating time (hour, minute, second, millisecond) would be ok imho
Does something like this works for you @Soviut ?
That's definitely more useful.
I think the : should be changed to something that does not appear in the timecode. Perhaps | or >
Also what should be the names for the the tags @Soviut @raphamorim
Do you mean the flags in the CLI? I would go with:
--timing=timecode
--timing=timestamp
Where timecode produces 00:00:00.000 and timestamp produces milliseconds since the epoch.
@Exar04 Here's a really good resource about timecode.
https://editingtools.io/timecode/
No stress/rush @Exar04 please take your time
Just a thought here: making the timecodes compatible with the FFmpeg metadata format (https://ffmpeg.org/ffmpeg-formats.html#Metadata-2) would allow for relatively easy tagging of videos with chapter markers (http://ikyle.me/blog/2020/add-mp4-chapters-ffmpeg or https://medium.com/@dathanbennett/adding-chapters-to-an-mp4-file-using-ffmpeg-5e43df269687 for details).
In fact, imagine -t=chapters, and a new .tape command like Chapter, that accepts a chapter name as the argument - the entire FFmpeg file could be auto-generated, and then the resulting .mp4 has chapter markers!
@Exar04 this "inconsistency" seems normal to me - computers don't always perfectly execute everything at the same speed. The sleep commands are pretty spot on (+/- 2 milliseconds), so I think it's fine?!
I don’t think wall clock is sufficient as drift becomes large. Instead, I used the captured frame to derive the timestamp as I describe in discussion #702.