First question is "what do you want to script?" There is a big difference between scripting something with simple beats (such as a cock hero video) and trying to match the on-screen action.
If it's a cock hero, there are three main techniques: audio, video or manual.
Audio is easiest if the author has shared a beats mp3 file. You can run it through
funscript generator or audacity and they'll detect the beat sounds and output a file automatically. If there isn't a beat file you might be able to get it working by adjusting the equaliser settings to drown out all the other sounds, but that can be tricky and unreliable.
If the video has a visible beat meter then Liquid has put together a tool called VideoSync. As long as you're comfortable compiling your own code then it can look at a specific location in a video (i.e. the beat bar) and generate a beat whenever it changes to a certain colour. A bit more involved, but still much faster than doing it manually!
If neither of these are possible, you're limited to doing it manually. For cock hero videos that usually means playing the video and hitting a button every time there is a beat. Again, I use VideoSync for this or sometimes JoyFunScripter.
If you want to match the on-screen action then it's much more involved.
JoyFunScripter or
OpenFunScripter are your best options. I find the quickest way is to make two passes through the video, one adding the top of each stroke at the relevant height and then play through the video again and add the bottom of each stroke. If you want these to be accurate it's often easiest to play the video at a slower speed, which means scripting 5 minutes of video can easily take 20+ minutes.