GuessParity
From Avisynth wiki
A script to guess the parity of your clip (thanks to mf).
function GuessParity(clip input) { input = AssumeFrameBased(input) global guessparitytff = AssumeTFF(input).SeparateFields().Bob() global guessparitybff = AssumeBFF(input).SeparateFields().Bob() istff = input.AssumeTFF().Subtitle("Guessed TopFirst", x=20, y=20) isbff = input.AssumeBFF().Subtitle("Guessed BottomFirst", x=20, y=20) ConditionalFilter(guessparitytff, istff, isbff, "YDifferenceFromPrevious(guessparitytff) + YDifferenceToNext(guessparitytff)", \ "<", "YDifferenceFromPrevious(guessparitybff) + YDifferenceToNext(guessparitybff)", false) }