Ok, I just finished trying the earlier script (the first, simpler one). I had to convert to YV12, then back to RGB, and also swapUV (my first attempt came out with a blue crawl!). It worked better than I thought it would. I'm not sure yet if I like the results - I have to study them carefully and see if they are doing what I want in the details.
Next I'll try your second set of scripts.
After I get some example clips, I'll post them.