Search mpeg / avi frames in linux
FFMPEG doesn't really have the tools to do motion detection out of the box. You can certainly do the cropping using the crop filter: -vf crop=w:h:x:y where w:h is the size of your cropped area and x:y its coordinates in the original image. So your ffmpeg script might look like:

ffmpeg -i input.avi -c:v libx264 -crf 20 -vf crop=123:45:67:89 output.mp4


Then you could find a frame of the output that contains no movement, export it to a still image, invert it and add it back to the video using overlay so that only parts of frames that are different would show up. Then use the blackdetect filter to find frames that are black. Then you could use some shell-fu to delete those parts of the video and finally concatenate the remainder into one clip. Whew.

…or you could use openCV. Here's a ready-rolled script that does motion detection: https://github.com/RobinDavid/Motion-detection-OpenCV