Detecting and estimating motion in videos