Sirs... your efforts are great but we are going slightly off topic.
The original question was a hopefully automatic way to recover red missing video files with AVISYNTH
Can I lead your great work to something we can replicate in that environment? GamMac and FredAverage, perhaps?