The script you will need is here: https://pastebin.com/dl/TUenvN77
Someone asked me in the comments of one of my videos ( • All Star but the frames are completely shu... ) to make a video describing how I made that video. Here it is.
You will need Python 2.7 to run the script: https://www.python.org/download/relea...
You will need Sony Vegas to be able to do this.
Also, I haven't tested this extensively on my own system, let alone anyone else's. It worked for a couple videos I tried, but I didn't try it with ones that have a non-integer framerate (although that should work fine), and I didn't try it with videos that didn't have audio. Just let me know if this isn't working for you and I'll see what I can do to help.