Skip to content

Conversation

Exar04
Copy link

@Exar04 Exar04 commented Apr 20, 2025

Adds feature #584

Screenshot 2025-04-20 at 12 46 53 PM

@Exar04 Exar04 requested a review from a team as a code owner April 20, 2025 07:17
@Exar04 Exar04 requested review from raphamorim and removed request for a team April 20, 2025 07:17
@Exar04 Exar04 changed the title feat:get timestamp for each command with flat --with-timestamp or -t feat:get timestamp for each command with flag --with-timestamp or -t Apr 20, 2025
@@ -255,6 +257,7 @@ func main() {

func init() {
rootCmd.Flags().BoolVarP(&publishFlag, "publish", "p", false, "publish your GIF to vhs.charm.sh and get a shareable URL")
rootCmd.Flags().BoolVarP(&withTimestampFlag, "with-timestamp", "t", false, "Get timestamp for each command in the output")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is ok to leave as timestamp instead of with-timestamp

@raphamorim
Copy link
Member

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.

@Soviut
Copy link

Soviut commented Apr 21, 2025

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.

@Exar04
Copy link
Author

Exar04 commented Apr 21, 2025

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.

@raphamorim
Copy link
Member

Perfect, please lemme know if need help with anything. Feel free to ping on my discord

@Soviut
Copy link

Soviut commented Apr 21, 2025

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.

image

@Exar04
Copy link
Author

Exar04 commented Apr 22, 2025

Screenshot 2025-04-22 at 1 04 03 PM Does something like this works for you @Soviut ?

Also what should be the names for the the tags @Soviut @raphamorim

@Exar04
Copy link
Author

Exar04 commented Apr 22, 2025

20/04/2025_11:47:43:32

I mean its just a stopwatch. should it have dates and stuff?

@raphamorim
Copy link
Member

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

@Soviut
Copy link

Soviut commented Apr 22, 2025

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.

@Soviut
Copy link

Soviut commented Apr 22, 2025

@Exar04 Here's a really good resource about timecode.

https://editingtools.io/timecode/

@Exar04
Copy link
Author

Exar04 commented Apr 23, 2025

Screenshot 2025-04-23 at 9 05 28 PM Hey sorry, but I think I have not implemented the feature correctly. Theres a inconsistency in timecodes. I will have to take a deeper look into it later. Sry this might take longer for me to implement it

@raphamorim
Copy link
Member

No stress/rush @Exar04 please take your time

@dzuelke
Copy link

dzuelke commented Aug 19, 2025

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!

@dzuelke
Copy link

dzuelke commented Aug 19, 2025

@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?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants