[HN Gopher] VHS: CLI home video recorder
___________________________________________________________________
VHS: CLI home video recorder
Author : denysvitali
Score : 216 points
Date : 2022-10-27 14:27 UTC (8 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| masukomi wrote:
| I wrote a blog post[1] breaking down tools to record terminal
| sessions just a couple weeks ago. I wasn't aware of this
| particular one but it looks like it's going to have issues with
| recording anything that requires user input.
|
| My post describes how to make high quality recordings of terminal
| sessions that can be replayed in the terminal, or shared on the
| web. I'm defining high quality as recordings with zero typos, and
| relatively controlled timing between commands.
|
| I'm going to assume this works well because all the stuff from
| Charm seems to, BUT its limitations are ... problematic. I think
| the techniques i list in the post combined with agg[2] or
| gifcast[3] to covert it to a gif would be a better solution for
| non-trivial cases.
|
| I'll add notes about agg and gifcast to the post this evening
| hopefully.
|
| [1]:
| https://weblog.masukomi.org/2022/10/11/recording_and_sharing...
|
| [2]: https://github.com/asciinema/agg
|
| [3]: https://github.com/dstein64/gifcast
| Philip-J-Fry wrote:
| Seems like it'd be fine for user input? You just tell it what
| the input is and it will record it.
| fimdomeio wrote:
| Would love to know what other people think about the overall
| design and comunication stategy of Charm. On one hand I already
| knew who did this project even before the image was fully loaded,
| youtube content seems interesting, and branding is very strong
| but I also feel a bit overwhelmed by all the brands shouting at
| me. they have Charm Cloud, VHS, Soft Serve, Buble Tea, Lip Gloss,
| Charm, Wish, Bubbles, Glamour, Harmonica, Gum, Skate, Glow.
| [deleted]
| naikrovek wrote:
| I miss how CPAN required that you name modules. they were named
| according to their capabilities, and they were narrowly scoped.
|
| these days, you just pick a word from the dictionary, and
| that's your software's name. now I have 1000 names to remember.
| silviot wrote:
| Similar tool: https://asciinema.org/
|
| It does not generate a GIF file, but can be easily published on
| the web. The recorded terminal session is clipboard friendly: you
| can select and copy.
| 2OEH8eoCRo0 wrote:
| The publishing is why I've avoided asciinema. Very easy to
| publish secrets. Can't easily share them around as an image
| either.
| nvrspyx wrote:
| > It does not generate a GIF file,...
|
| Although it's separate, the creator(s) does provide a utility
| called `agg`[0] to convert asciicast files to GIF. The GitHub
| appears to provide prebuilt binaries in Releases, but it's
| easily built using Cargo/Rust too.
|
| 0: https://github.com/asciinema/agg
| ronilan wrote:
| To generate GIFs use: https://github.com/dstein64/gifcast
| Works in the browser and locally. No install needed.
| naikrovek wrote:
| do you still have to go to asciinema.org to view them? that
| always rubbed me the wrong way, whether it was a requirement or
| just the dominant preference.
| mzs wrote:
| Thanks!
|
| https://github.com/asciinema/asciinema
| iamjackg wrote:
| I love asciinema. A key difference between these two tools
| seems to be that asciinema records a human using the terminal,
| whereas VHS generates output based on a list of steps to
| execute.
|
| I can see VHS being nicer than asciinema for a lot of
| applications, since you can avoid typos and fumbling, and you
| can easily re-render the same output with different settings.
| lyarwood wrote:
| I've started using demo-magic [1] to automate my asciinema
| recorded demos, not perfect but it gets the job done. VHS
| does look excellent however and I'll definitely be giving it
| a go the next time I need to record anything.
|
| [1] https://github.com/paxtonhare/demo-magic
| aliqot wrote:
| Charmbracelet is a gem. Ran across their stuff a year or two ago
| and it's just a pleasure.
| 2OEH8eoCRo0 wrote:
| Very cool. I love their other projects as well.
|
| https://charm.sh/
| sandreas wrote:
| Maybe another alternative for inspiration:
| https://github.com/faressoft/terminalizer
|
| I love it because it gives you the option to record or to prepare
| your file... very easy and good results.
| maaslalani wrote:
| We definitely want to add an option to record a session which
| would output a generated file for you!
| crummy wrote:
| > VHS has an SSH server built in! When you self host VHS you can
| access it as though it were installed locally. VHS will have
| access to commands and applications on the host so you don't need
| to install them on your machine.
|
| That is super slick!
| tarboreus wrote:
| Cool name and file extension. This person could be in branding.
| zero_iq wrote:
| Almost certainly trademark infringement though.
| jandrese wrote:
| Trademarks are domain specific, so it wouldn't be an open and
| shut case.
| zero_iq wrote:
| It wouldn't get to trial. Cease and desist letter with the
| threat of legal action would likely do the trick, as
| charmbracelet likely have insufficient funds to defend
| themselves, and it simply wouldn't be worth the money to
| defend a small project name. At the very least it would be
| easy to force them to remove any use of VHS in relation to
| video tapes: they have a giant picture of a VHS video tape
| on their homepage!
|
| If the trademark owner discovers this, they would be
| legally obliged to defend their trademark if they want to
| keep it.
|
| JVC/Kenwood has previously successfully defended their mark
| when used in artworks/apparel (which are not in the same
| domains).
| asicsp wrote:
| This is awesome! I can see adding a demo for at least one of my
| projects.
|
| Based on a quick glance, I'd say the best thing about it is that
| can you reuse the script (for ex: something changed with the
| command usage/output, automate recording for different command,
| etc).
| dbieber wrote:
| This looks super useful. Tempted to go and add CI-maintained gifs
| to a whole bunch of existing projects now.
|
| Some ideas for new features:
|
| * If the prefix of the tape file is unchanged, reuse the
| intermediate updates through that prefix from a cache (edit: hmm,
| upon further thought this seems more difficult than I initially
| imagined, since the state would need to be cached to save time,
| not just the images)
|
| * Allow an option for using real-time delays in the gif or user-
| selected delays (I think currently delays are constant unless
| user-selected, but I don't see a way to use the real runtime
| delay in the gif)
| mdaniel wrote:
| they even have a tree-sitter parser for vhs/.tape --
| https://github.com/charmbracelet/tree-sitter-vhs#readme -- but
| then they hand-roll the parser for it in the actual vhs repo
|
| Is tree-sitter so hard to use in anger that it's worth the
| diverging implementations?
| maaslalani wrote:
| We started off hand rolling the parser and had that fully
| implemented and then wrote the tree-sitter grammar. If I were
| to do it again I would probably use tree-sitter for the actual
| repo so that the implementations were the same for sure.
| politelemon wrote:
| Nice tool. As a nit,
|
| > Linux > brew
|
| Please don't do this, it's not safe, despite it "existing" as an
| option. Even a binary download is better than suggesting brew on
| Linux.
| Hackbraten wrote:
| What do you feel is unsafe about Homebrew?
| Yajirobe wrote:
| why
| jhbadger wrote:
| Perhaps you don't understand the use case. It's often the only
| option for users to install packages on an HPC system, as on
| such systems you cannot install things as root so the system
| package manager is infeasible. The only other possibility is
| Anaconda, but that has its origins as a Python tool and only
| has a fairly limited set of non-Python related packages.
| MaintenanceMode wrote:
| At one of the Open Source Conferences (OSCON) I saw Damian Conway
| use a tool like this (I believe it was asciinema) to give one of
| the best command line based demos I've ever seen. He was typing
| away like mad and not one typo! It was mesmerizing and the demo
| was totally awesome, of course it helps that he's a superb
| presenter to begin with.
|
| Later he revealed the "magic trick"!
| scohesc wrote:
| When did Github get play/pause controls on GIF images?
|
| Pretty neat! I've always had a gripe with GIF's autoplaying after
| the page loads so the first time I see it it's halfway through
| the animation.
|
| VHS looks like a pretty neat tool! Not sure if I'd use it, but
| definitely some use cases out there for tutorials, guides, etc.
| sophacles wrote:
| I've done a few gifs of "this happens" for bug reports and the
| like. One thing that this solves is the "ugh i screwed up the
| sequence, time to try recoring for the 10th time" problem, so
| that's interesting. I wonder how well it works with programs
| that set their input line discipline to "raw" or read from the
| pty directly - ncurses-like interfaces and things like sudo,
| etc.
| throwaway744678 wrote:
| I don't see the play/pause buttons (Chrome on Android): gif are
| autoplaying. Perhaps it comes from your browser?
| scohesc wrote:
| Maybe, I'm using Firefox - I wonder if that's built into the
| browser now?
|
| I really wish there was a set of browser standards for at
| least a modicum of similarity (I guess chromium is one?)-
| things are all over the place still hahaha
| 6345dhjdsf wrote:
| If the author's reading this, please consider whether a picture
| of a video cassette was really of value, and if it was please
| don't put in a bloody great 2MB image.
| maaslalani wrote:
| Author here. Fair point! Definitely forgot to compress it and
| make it smaller. Thanks for the call out.
| elsurudo wrote:
| For what it's worth, I enjoyed the nice cassette logo :)
| ndegruchy wrote:
| So, this seems to just download chrome and run some sort of
| terminal emulator in it (then converts it to video). Do I have
| that right? Seems like massive overkill for something you could
| do with just ffmpeg and a terminal emulator...
| taviso wrote:
| I've actually used ffmpeg + GNU screen to do something very
| similar in the past.
|
| The benefit of using GNU screen is that the "tape" can be a
| shell script. I suppose if you don't like shell scripts that's
| not a benefit, but I do like them.
|
| For example, instead of: Type "echo 'Welcome
| to VHS!'" # Pause for dramatic effect... Sleep
| 500ms Enter
|
| With GNU screen, you would write: #!/bin/sh
| screen -d -m -S whatever -- bash screen -S whatever -X
| stuff "echo Welcome to screen" sleep 0.5
| screen -S whatever -X stuff $'\n'
|
| If you want to start interacting with the session, just do
| screen -r whatever
|
| You can also read what is in the screen with -X hardcopy, then
| do something with the output, like verify the output is correct
| or adjust the input.
| maaslalani wrote:
| This is actually really cool. Thanks for sharing this!
| mdaniel wrote:
| I think that may just be copy-paste in the Dockerfile, as it
| doesn't seem to use chromium (nor chrome) anywhere else in the
| repo:
| https://sourcegraph.com/search?q=context:global+repo:%5Egith...
|
| which for sure matches my mental model of using ttyd and ffmpeg
| -- what in the world would anyone need chromium for?
| nvrspyx wrote:
| One of the dependencies is `rod`[0], which is a web
| scraping/automation library, and I believe requires a browser
| to work. I don't know what they're using it for though as I
| haven't looked at the code (and I'm not familiar with Go
| anyways). There's a feature of the library that finds and
| installs a browser, but they may just be preemptively
| including chromium in the dockerfile and assuming that non-
| docker users will already have a supported browser on their
| machine.
|
| 0: https://github.com/go-rod/rod
| taviso wrote:
| > what in the world would anyone need chromium for?
|
| Perhaps rendering an xterm.js canvas? (I don't know, it's
| just a guess)
| txutxu wrote:
| Really nice!
|
| Which font family can be used? I'm trying with font names from
| fonts that I have installed (i.e. Terminus or terminus) and it's
| not working.
| stavros wrote:
| Oooh this looks great! I have a soft spot for terminal recording
| tools.
|
| I made the inverse of this (give it keystrokes and it plays them
| back as you type, for live demos:
| https://gitlab.com/stavros/itsalive).
___________________________________________________________________
(page generated 2022-10-27 23:00 UTC)