Dust specks flash on for a single frame; long scratches run down the film where it dragged against something. Two different problems, two cures.
The key insight for dust: a speck exists in one frame only. So take the temporal median, for each pixel, the middle value across the previous, current and next frame, and the odd-one-out speck is thrown away automatically. But that alone would erase anything genuinely moving. So RestoreMotionBlocks detects the moving blocks and copies the original pixels back into them. Finally DeScratch hunts the long vertical lines specifically.
DeScratch is kept deliberately conservative so it targets only thin, long,
near-vertical lines and leaves real vertical structures (a doorframe, a pole)
alone: maxwidth=5 (thin), minlen=100 (long),
maxangle=3 (near-vertical), mindif=6 (clear scratches only).