Image Processing to detect differences in flashing frames

I have a need to detect when a screen “stops changing” and that time will then be considered “done”. So first, the flashing is every 1 seconds, so if we average out frames in 2 seconds and use that “rolling averaged” frame vs. the subsequent rolling average (so 1 averaged frame later) and do some math to say “how much different” then we can look for when the changes stop and be happy we have an answer. So average 48 frames if you are using 24fps.

Where to start? ImageMagick I think is a good place.