identify abrupt frame changes in a video
Easiest is to capture video with an h.264 encoder, which uses key frames to identify switches. (It’s a bit more complicated, h264 will handle situations where frames come alternatively fro two different source, for example), but extracting that information from a video stream is easier than doing it yourself). 

Source code for decoders is available, and a decoder will also give you useful information about movement, and things that become covered or uncovered.