738

March 4th, 2024 × #automation#ai#productivity

Little Scripts: Coding for your Co-workers

Discussion on writing small scripts to help coworkers and improve workflows using tools like FFmpeg, AI, and automation

or
Topic 0 00:00

Transcript

Wes Bos

we have a editor now, Randy, and he is doing all the producing and exporting of the video and and editing it all together and and writing all the show notes and stuff. And, he's got lots of of processes. Right? And some of those parts Yarn, like, he hit little issues or things can be sped up in a certain way. So we've been writing little scripts here and there, to Scott help him out, and I thought, like, this is kind of an interesting show because, like, even as, like, a video editor, no matter how good you are at your tools, you can certainly improve either the speed at which you do things or the accuracy at which you do things when you can TypeScript and and process improvements into that flow. So I thought we would just kinda talk about a couple examples of things that you can do, and talk about how do you actually write these things and hand them off to people who who need to do them? Yeah. And, you know, they can even help you out. They could be a good introduction

Topic 1 02:12

Sentry tracks down bugs in sites

Wes Bos

Alright. Let's talk about, the first one, which is we'll say the problem that Randy had. So we are doing a podcast now that is both video and in audio. So the process is that Randy edits the whole video podcast, and then he puts the chapter markers into the video and and exports that JS, MP 4.

Topic 2 03:04

Script to export video chapters to MP3 chapters

Wes Bos

And the way that chapter markers work in, his DaVinci Resolve is that it just embeds them into the actual file. If you there's a really handy tool called f f probe. It's part of FFmpeg.

Wes Bos

Mhmm. And if you ever just type f f probe and and give it a, a file, it will tell you all the information about that specific video file. And, in fact, when when Randy came over here, we were testing out, I think, about 5 different recording softwares to see, like, what what are the bit rates, what are the frame rates, like, all of that information of, like, who's actually giving us the best quality video out the other end at the end of the day. So I was just I just do f f pro, and it dumps all the info. He's like, man, like, amazing that you can just you could just do this this kind of stuff, which is really cool.

Wes Bos

So he does that with with video, but then when we converted it, we export as a m p 3 from Resolve.

Wes Bos

It was stripping the the markers. There's no way to export a m p 3 with embedded chapters, which JS, of course, all the podcast apps need that to to give a audio chapter. So I was just like, alright. Well, let me see what we can Node. And I just FFmpeg.

Wes Bos

The knuckles.

Wes Bos

Yeah. And it kicked out the chapters in, like, 2 seconds, and I was like, oh, damn. Like, that was really handy. So we just put together a little script that would do that JS well as one thing we're working on is also just scaffold out all the chapters into the markdown file because he has to write the show notes as Wes.

Wes Bos

And just like that kind of stuff. Like, even if it takes them 15 minutes, like, that's 15 minutes that you can spend on doing something else. So FFmpeg is just like we might even do a whole different show on FFmpeg, but it's it's amazing, that tool, of everything that it possibly does. And it always it always just works. Yeah. I was I I was getting deep into

Topic 3 04:58

Scripts can validate markdown format for show notes

Wes Bos

It it's true. Like, I Randy was, like, googling for little commands to run it. Like, he's like, oh, like, let me try compress the MP 3 a little bit much. We don't need the bit rate for just for just, spoken word. Yeah. And I was like, yeah. Just use chat gpt, and it'll kick out the you just tell it what you want it to do, and it'll kick out the actual, crazy long FFmpeg command for you. And it's amazing. It almost works every single time. Yeah. Amazing.

Topic 4 08:04

Scripts can add validation to processes requiring strict steps

Wes Bos

Yeah. Anytime you have a process where the steps must be done perfectly and you Yeah. Hopefully shouldn't miss something that like, many times in the past, we've we've not broken the site, but, like, we have a broken build because there's a a missing dash somewhere or, like, on the old website, we put in couldn't put colons into the the show titles because the show title was in front matter and, like, so many of these little things that, like, you shouldn't have to rely on a human catching every single thing. Right? You should be able to write some sort of script that will put those safeguards in place that will sort of catch them for you. Because I thought it was hilarious because on the show, in the past, we've said, don't give your clients markdown. You know? Yeah. Like, my blogs are markdown, but I don't think I would ever hand off markdown to to an actual client. And, Wes we gave it to Randy, and they'll say, hey. You gotta learn And, like, there's there's so many things that could could potentially go wrong when you're writing markdown, so it's nice to have all those validation steps in place now.

Wes Bos

One one kinda interesting idea I'm gonna I'm just gonna pitch it this to you, Scott. And That's it. It it's also probably worth talking to Randy about to see if this would be handy as well is our process right now for the transcript and the AI show notes on the podcast is the editor edits the thing. The editor writes our own show notes, and then publishes it. And and once it's public, we run that. We get a whole we get a transcript for it, and we get a whole bunch of AI show notes for it. Meaning that we ask it to summarize the major talking points.

Topic 5 09:59

AI can generate initial show notes to help editor

Wes Bos

And they're they're really good. Like, Matt Pocock on Twitter was asking about when would you use Axios over just built in fetch? And I just screenshotted the AI summary of all of the bullet points from that Node. And it was, like, the perfect like, you don't even have to listen to the episode. You just read that list of bullet points, and and you kinda get a good idea of of what's going on. And I was like, if those are so good, why don't we do in like, do a 1st run of the show Node? Show notes. Yeah.

Wes Bos

With first, get the transcript because it can be easier to edit video if you can cut it at a specific word, like or you can search for where oh, where did he talk about x, y, and z? And second, DaVinci Resolve has a an API which you can programmatically embed markers or you can I think it's like an ETL file? You can import markers from specific time stamps. And I was like, well, if we did, like, a first pass of get the transcript and then get the the major bullet points, immediately put those into resolve. And, obviously, like, he's a human. He can take it a little bit further, and and change it and rename things. But, like, wouldn't that be, like, a a little bit of a head start to get a little bit more context for for the video,

Wes Bos

and and, like, ideally, at the end of the day, we would just have, like, the AI show notes and the human written show notes will be some sort of morphed together type of thing. And, like, another thing we do is every single show, we have to figure out what are good clips from that specific episode. And there's lots of AI clip generation things, or you can you can give it a transcript and say, hey. Give me give me points, and they're not all that good. But Scott asked me to pull a whole bunch of clips out the other day.

Topic 6 12:40

AI transcript helps find clips in episodes

Wes Bos

And what I did is I just took the transcript.

Wes Bos

I put it ESLint Claude, and I just gave it the prompt that says, give me the topics and then maybe even give me some, like I Wes like, give me some interesting points. Give me some funny points.

Wes Bos

And then just from all of that data, I was able to say, okay. Well, I'm I've listened to the podcast because I was on it, and I have a good idea of where in the episode these things were talked about.

Wes Bos

That made it so much faster because I didn't have to just sit there and listen to the whole thing again to scrub and find the parts. I could just visually see where they were. So I think, like, I I think we still have to do the transcript and the AI show notes after it's all edited, but I think if we also do it on the raw value, I think you could get a lot of value out of that.

Wes Bos

Oh, it's true. Yeah. You could you could do quite a bit with that.

Wes Bos

And, like, sometimes now, I'm I'm frustrated where you're you're on a YouTube video, and there's not chapters in it. And I got you think, like, come on, YouTube. Like, if someone doesn't provide chapters, at least find it out. Like, Google search does that. If you search and the answer is in a video, it will try to link you to where in that video the thing is answered, and it's it's pretty decent. So, obviously, they have that information.

Topic 7 16:17

Challenges giving scripts to non-developers

Wes Bos

Mhmm. Yeah. There's giving it to somebody who is not a developer is always a a tricky thing to do because you have to bundle it up into some easy way. Otherwise, if it's like like, we all know the, like, the overbearing technical person who's like, oh, why are you doing it that way? I could make it so much easier if I give you these 11 things, and then, like, they're not actually gonna use that because it's it's too complicated. It doesn't actually fit fit into their workflow.

Wes Bos

It breaks halfway through. You know? Mhmm. So with Randy, I wrote a, perfect example. It didn't actually work that well because it I don't know why, but we needed FFmpeg.

Wes Bos

The script itself was in Node, but in order to get the context menu on Bos, like, basically, we wanna right click, convert this to m p 3, and scaffold out the show notes.

Wes Bos

So that had to be triggered in bash.

Wes Bos

Oh, no. It was an Apple script which triggered a bash, which ran a Node JS script. So I had to get Randy to, like, install Homebrew, and then Homebrew install FFmpeg, and then install Node JS, and then there was some permissions issues, which I had never hit before, and then he needed Node, in order to run. You know? Like, it's just like, and, he ended up we ended up just using straight FFmpeg. I showed him how to do it, but, like, I was thinking, like, man, it might have been faster to just build a little website with a drop zone, and Wasm because FFmpeg has a Wasm that runs in the browser, and I could simply just convert it in the browser and then allow you to click it and download it.

Wes Bos

That's the beauty of of the browser JS that you can make contained shippable applications.

Wes Bos

So I think that that might have been a a better idea.

Wes Bos

AppleScript itself, I have written so many AppleScripts in my day, and I always always am so frustrated. There's a there's a whole JavaScript API for writing AppleScript, and I could never never get it to work properly. I never understand what to do, and it you're half in this, like, weird GUI with things that are connected to each other, and I'd rather just have a a node script and have everything up and running.

Topic 8 18:42

Recommend browser app over desktop app for user-friendliness

Wes Bos

Another one from John Linkwitz TypeScript kit.

Wes Bos

And for somebody who writes, like, a lot of little scripts to automate things, this is a super handy tool. Go to scriptkit.com and check it out. I don't think they have this. I really wish that instead of having to open it, it kinda has, like, a Raycast interface, but I really wish that it would integrate with OS X finder so you can simply just right click convert, because that would honestly, that's the the ideal type of thing to be able to do it. Because whenever you're getting into Node TypeScript, then you Scott, like sometimes you gotta kick out to a different script or you gotta, like, how do you pass a file into Node. Js from a GUI? You gotta tell them to, like, CD into a directory. So some sort of bridge between those 2 things would be really neat.

Topic 9 20:19

Invite listeners to share scripts they've written

Wes Bos

I think I think that's it. Like, running the scripts, those are there's probably lots of other ways. Bash scripts is one. I always regret writing Bash scripts because yeah. A little simple one, but then you wanna get into concurrency or you wanna loop over some files. And then before you know it, you're just like, what have I done? I wish I just had done this in, in Node. Js. And there's even a a whole bunch of different files. There's one called DAX that got released last week from the Deno folks, which is you write it in Node. Js or you write it in JavaScript, but you can run shell commands.

Wes Bos

No problem. I use another one on the syntax website to do that as well. Let me find the name of it. It's because I I we have to move files from 1 folder to another before we deploy because of some Vercel limitation, and I use zed x. So zed x is another one from Google, and it's it's because you can just say dollar sign back text and then write the bash script right inside of there, like CP or NPM install, and it will go off on a trial process, run that, and then come back with the actual, standard error, standard input.

Wes Bos

Yeah. I'd I'm very proud of Scott of Canadian stuff, but the whole Zed thing,

Wes Bos

I'll, I'll fold on that one.

Wes Bos

But that's it. Let us know what your scripts are that you've written for your coworkers and whatnot, because I love doing this type of stuff. There's automating things away, making things much easier.

Wes Bos

It's it's fun just to build it. Even if I'm not save saving time, I'll still build a little script to to automate it because it's fun for me to architect it.

Wes Bos

But, certainly, there's lots of people in your organization that might need a little help with that type of thing.

Wes Bos

Alright. Peace.

Share

Play / pause the audio
Minimize / expand the player
Mute / unmute the audio
Seek backward 30 seconds
Seek forward 30 seconds
Increase playback rate
Decrease playback rate
Show / hide this window